Class FDBDirectorySharedCacheManager
java.lang.Object
com.apple.foundationdb.record.lucene.directory.FDBDirectorySharedCacheManager
A cache for
FDBDirectory blocks that can be shared between record contexts.
The scope is the record store. Each directory cache is keyed by the index subspace's suffix relative to the record store plus
any grouping key.
Additionally, the cache is per directory sequence number. Any transaction that changes the directory must also advance this
counter. Only the latest sequence number's cache is retained by this manager, although it is possible that multiple older
transactions continue to share one.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forFDBDirectorySharedCacheManager. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFDBDirectorySharedCacheManager(Subspace subspace, int maximumSize, int concurrencyLevel, int initialCapacity) -
Method Summary
Modifier and TypeMethodDescriptionforContext(FDBRecordContext context) Get any shared cache manager for the given context.Get a cache for a directory.intintintvoidsetForContext(FDBRecordContext context) Set the given shared cache manager in the given context.
-
Field Details
-
SHARED_CACHE_CONTEXT_KEY
-
-
Constructor Details
-
FDBDirectorySharedCacheManager
protected FDBDirectorySharedCacheManager(@Nullable Subspace subspace, int maximumSize, int concurrencyLevel, int initialCapacity)
-
-
Method Details
-
getSubspace
-
getMaximumSize
public int getMaximumSize() -
getConcurrencyLevel
public int getConcurrencyLevel() -
getInitialCapacity
public int getInitialCapacity() -
forContext
@Nullable public static FDBDirectorySharedCacheManager forContext(@Nonnull FDBRecordContext context) Get any shared cache manager for the given context. Note that attaching the cache manager to the context means that the context cannot perform Lucene queries against multiple record stores.- Parameters:
context- the record context in which to find the shared cache manager- Returns:
- the shared cache manager set in the context or
nullif none has been set - See Also:
-
setForContext
Set the given shared cache manager in the given context.- Parameters:
context- the record context in which to put the shared cache manager
-
getCache
Get a cache for a directory.- Parameters:
key- the directory key, including the index prefix and any grouping keyssequenceNumber- the sequence number of the directory as read in the current transaction- Returns:
- a shared cache of
nullif the sequence number is too old
-
newBuilder
-