Class FDBDirectorySharedCache
java.lang.Object
com.apple.foundationdb.record.lucene.directory.FDBDirectorySharedCache
A shared cache for a single
FDBDirectory.-
Constructor Summary
ConstructorsConstructorDescriptionFDBDirectorySharedCache(Tuple key, long sequenceNumber, int maximumSize, int concurrencyLevel, int initialCapacity) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getBlockIfPresent(long id, int blockNumber) Get a block from a file if present in the cache.Get the set of file references for this directory, if present in the cache.getKey()Get the key for this directory cache.longGet the sequence number of this directory cache.voidputBlockIfAbsent(long id, int blockNumber, byte[] block) Add a block from a file to the cache.voidsetFieldInfosReferenceCount(ConcurrentMap<Long, AtomicInteger> fieldInfosReferenceCount) voidsetFileReferencesIfAbsent(Map<String, FDBLuceneFileReference> fileReferences) Add set of file references to the cache.
-
Constructor Details
-
FDBDirectorySharedCache
public FDBDirectorySharedCache(@Nonnull Tuple key, long sequenceNumber, int maximumSize, int concurrencyLevel, int initialCapacity)
-
-
Method Details
-
getKey
Get the key for this directory cache. The key is relative to the record store root, so including the index subspace prefix and any grouping keys.- Returns:
- the key for this directory cache
-
getSequenceNumber
public long getSequenceNumber()Get the sequence number of this directory cache. The sequence number advances whenever new data is written to the directory.- Returns:
- the sequence number of this directory cache
-
getFileReferencesIfPresent
Get the set of file references for this directory, if present in the cache.- Returns:
- cached file references or
nullif not cached
-
setFileReferencesIfAbsent
Add set of file references to the cache.- Parameters:
fileReferences- the file references for the associated directory as of the sequence number
-
getBlockIfPresent
@Nullable public byte[] getBlockIfPresent(long id, int blockNumber) Get a block from a file if present in the cache.- Parameters:
id- file idblockNumber- block number in the file- Returns:
- the cached block or
nullif not cached
-
putBlockIfAbsent
public void putBlockIfAbsent(long id, int blockNumber, @Nonnull byte[] block) Add a block from a file to the cache.- Parameters:
id- file idblockNumber- block number in the fileblock- the block to be cached
-
setFieldInfosReferenceCount
-
getFieldInfosReferenceCount
-