Class MetaDataVersionStampStoreStateCacheFactory
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.storestate.MetaDataVersionStampStoreStateCacheFactory
-
- All Implemented Interfaces:
FDBRecordStoreStateCacheFactory
public class MetaDataVersionStampStoreStateCacheFactory extends Object implements FDBRecordStoreStateCacheFactory
A factory for creatingMetaDataVersionStampStoreStateCache
s.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_EXPIRE_AFTER_ACCESS_MILLIS
The default amount of time in milliseconds after last access that cache entries should start to be expired.static long
DEFAULT_MAX_SIZE
The default maximum number of items to include in the cache.static long
UNLIMITED
A constant indicating that the cache should be of unlimited size or keep items for an unlimited time.
-
Constructor Summary
Constructors Constructor Description MetaDataVersionStampStoreStateCacheFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FDBRecordStoreStateCache
getCache(FDBDatabase database)
Produce aFDBRecordStoreStateCache
.long
getDefaultExpireAfterAccessMillis()
Get the amount of time in milliseconds that each entry is kept in each cache after its last access.long
getMaxSize()
Get the maximum number of elements to keep in produced caches.static MetaDataVersionStampStoreStateCacheFactory
newInstance()
Create a new factory.MetaDataVersionStampStoreStateCacheFactory
setExpireAfterAccessMillis(long expireAfterAccessMillis)
Set the number of milliseconds to keep an item in produced caches after it has been accessed.MetaDataVersionStampStoreStateCacheFactory
setMaxSize(long maxSize)
Set the maximum number of elements to keep in produced caches.
-
-
-
Field Detail
-
UNLIMITED
public static final long UNLIMITED
A constant indicating that the cache should be of unlimited size or keep items for an unlimited time.- See Also:
- Constant Field Values
-
DEFAULT_MAX_SIZE
public static final long DEFAULT_MAX_SIZE
The default maximum number of items to include in the cache.- See Also:
- Constant Field Values
-
DEFAULT_EXPIRE_AFTER_ACCESS_MILLIS
public static final long DEFAULT_EXPIRE_AFTER_ACCESS_MILLIS
The default amount of time in milliseconds after last access that cache entries should start to be expired.
-
-
Method Detail
-
getCache
@Nonnull public FDBRecordStoreStateCache getCache(@Nonnull FDBDatabase database)
Description copied from interface:FDBRecordStoreStateCacheFactory
Produce aFDBRecordStoreStateCache
. Two instances produced by this factory should not share any common state as they should not be assumed to cache store information for record stores from the same database.- Specified by:
getCache
in interfaceFDBRecordStoreStateCacheFactory
- Parameters:
database
- the database that the produced cache will be used with- Returns:
- a
FDBRecordStoreStateCache
-
setExpireAfterAccessMillis
@Nonnull public MetaDataVersionStampStoreStateCacheFactory setExpireAfterAccessMillis(long expireAfterAccessMillis)
Set the number of milliseconds to keep an item in produced caches after it has been accessed. This value can be set toUNLIMITED
to indicate that the items in caches produced by this factory should not be limited by time.- Parameters:
expireAfterAccessMillis
- the amount of time to keep the item in each cache after last access- Returns:
- this factory
-
getDefaultExpireAfterAccessMillis
public long getDefaultExpireAfterAccessMillis()
Get the amount of time in milliseconds that each entry is kept in each cache after its last access.- Returns:
- the amount of time to keep the item in each cache after last access
-
setMaxSize
@Nonnull public MetaDataVersionStampStoreStateCacheFactory setMaxSize(long maxSize)
Set the maximum number of elements to keep in produced caches. This value can be set toUNLIMITED
to indicate that no maximum size should be imposed on the number of items in each cache.- Parameters:
maxSize
- the maximum number of elements to keep in each cache- Returns:
- this factory
-
getMaxSize
public long getMaxSize()
Get the maximum number of elements to keep in produced caches.- Returns:
- the maximum number of elements to keep in each cache
-
newInstance
@Nonnull public static MetaDataVersionStampStoreStateCacheFactory newInstance()
Create a new factory.- Returns:
- a new factory of
MetaDataVersionStampStoreStateCache
s
-
-