Class FDBDirectorySharedCache

java.lang.Object
com.apple.foundationdb.record.lucene.directory.FDBDirectorySharedCache

@API(EXPERIMENTAL) @ThreadSafe public class FDBDirectorySharedCache extends Object
A shared cache for a single FDBDirectory.
  • Constructor Details

    • FDBDirectorySharedCache

      public FDBDirectorySharedCache(@Nonnull Tuple key, long sequenceNumber, int maximumSize, int concurrencyLevel, int initialCapacity)
  • Method Details

    • getKey

      @Nonnull public Tuple 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

      @Nullable public Map<String,FDBLuceneFileReference> getFileReferencesIfPresent()
      Get the set of file references for this directory, if present in the cache.
      Returns:
      cached file references or null if not cached
    • setFileReferencesIfAbsent

      public void setFileReferencesIfAbsent(@Nonnull Map<String,FDBLuceneFileReference> fileReferences)
      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 id
      blockNumber - block number in the file
      Returns:
      the cached block or null if 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 id
      blockNumber - block number in the file
      block - the block to be cached
    • setFieldInfosReferenceCount

      public void setFieldInfosReferenceCount(ConcurrentMap<Long,AtomicInteger> fieldInfosReferenceCount)
    • getFieldInfosReferenceCount

      public ConcurrentMap<Long,AtomicInteger> getFieldInfosReferenceCount()