Class ReadVersionRecordStoreStateCacheFactory
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.storestate.ReadVersionRecordStoreStateCacheFactory
-
- All Implemented Interfaces:
FDBRecordStoreStateCacheFactory
@API(EXPERIMENTAL) public class ReadVersionRecordStoreStateCacheFactory extends Object implements FDBRecordStoreStateCacheFactory
A factory for creatingReadVersionRecordStoreStateCache
s.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_DEADLINE_TIME_MILLIS
Default deadline time to load entries into this cache.static long
DEFAULT_MAX_SIZE
Default maximum number of elements to cache.static long
DEFAULT_REFRESH_TIME_MILLIS
Default refresh time for cache entries (in milliseconds).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReadVersionRecordStoreStateCache
getCache(FDBDatabase database)
Create a newReadVersionRecordStoreStateCache
.static ReadVersionRecordStoreStateCacheFactory
newInstance()
Create a new factory.ReadVersionRecordStoreStateCacheFactory
setDeadlineTimeMillis(long deadlineTimeMillis)
Set the maximum amount of time to wait for an entry to be loaded.ReadVersionRecordStoreStateCacheFactory
setMaxSize(long maxSize)
Set the maximum number of entries to cache.ReadVersionRecordStoreStateCacheFactory
setRefreshTimeMillis(long refreshTimeMillis)
Set the maximum amount of time to keep an entry in the cache.
-
-
-
Field Detail
-
DEFAULT_REFRESH_TIME_MILLIS
public static final long DEFAULT_REFRESH_TIME_MILLIS
Default refresh time for cache entries (in milliseconds). By default, this is set to 5 seconds, which is equal to the FoundationDB global transaction time limit.- See Also:
- Constant Field Values
-
DEFAULT_DEADLINE_TIME_MILLIS
public static final long DEFAULT_DEADLINE_TIME_MILLIS
Default deadline time to load entries into this cache. This is set to the same default as theAsyncLoadingCache
's default deadline time.
-
DEFAULT_MAX_SIZE
public static final long DEFAULT_MAX_SIZE
Default maximum number of elements to cache.- See Also:
- Constant Field Values
-
-
Method Detail
-
setRefreshTimeMillis
@Nonnull public ReadVersionRecordStoreStateCacheFactory setRefreshTimeMillis(long refreshTimeMillis)
Set the maximum amount of time to keep an entry in the cache. Note that as read versions are only valid for a limited time in FoundationDB, it makes little sense to set this value to something above the global transaction time limit.- Parameters:
refreshTimeMillis
- the maximum amount of time to keep an entry in milliseconds- Returns:
- this factory
-
setDeadlineTimeMillis
@Nonnull public ReadVersionRecordStoreStateCacheFactory setDeadlineTimeMillis(long deadlineTimeMillis)
Set the maximum amount of time to wait for an entry to be loaded.- Parameters:
deadlineTimeMillis
- the maximum amount of to wait for an entry to be loaded in milliseconds- Returns:
- this factory
-
setMaxSize
@Nonnull public ReadVersionRecordStoreStateCacheFactory setMaxSize(long maxSize)
Set the maximum number of entries to cache.- Parameters:
maxSize
- the maximum number of elements to store in the cache- Returns:
- this factory
-
getCache
@Nonnull public ReadVersionRecordStoreStateCache getCache(@Nonnull FDBDatabase database)
Create a newReadVersionRecordStoreStateCache
. It will inherit the refresh time, the deadline time, and the maximum size set by this factory.- Specified by:
getCache
in interfaceFDBRecordStoreStateCacheFactory
- Parameters:
database
- the database that the produced cache will be used with- Returns:
- a new
ReadVersionRecordStoreStateCache
-
newInstance
@Nonnull public static ReadVersionRecordStoreStateCacheFactory newInstance()
Create a new factory.- Returns:
- a new factory of
ReadVersionRecordStoreStateCache
s
-
-