@API(value=EXPERIMENTAL) public interface MetaDataCache
FDBMetaDataStore
.
A cache implementation can implement any subset of object, serialized and version cached.
The caller is responsible for calling all of the relevant the set
methods
when something changes.
Note that this interface is currently undergoing active development. Work on evolving this API is currently being tracked as part of Issue #280. Users are advised to avoid implementing or using this interface until work on that issue has been completed.
Modifier and Type | Method and Description |
---|---|
default RecordMetaData |
getCachedMetaData()
Get cached
RecordMetaData object. |
default byte[] |
getCachedSerialized()
Get cached serialized meta-data.
|
default CompletableFuture<Integer> |
getCurrentVersionAsync(FDBRecordContext context)
Get a version to use for cache validation of
-1 to skip validation. |
default void |
setCachedMetaData(RecordMetaData metaData)
Cache meta-data object.
|
default void |
setCachedSerialized(byte[] serialized)
Cache serialized meta-data.
|
default void |
setCurrentVersion(FDBRecordContext context,
int version)
Update the version used for cache validation.
|
default CompletableFuture<Integer> getCurrentVersionAsync(FDBRecordContext context)
-1
to skip validation.context
- the transaction to use to access the database@Nullable default RecordMetaData getCachedMetaData()
RecordMetaData
object. For instance, from a Guava cache.@Nullable default byte[] getCachedSerialized()
default void setCurrentVersion(FDBRecordContext context, int version)
If maintained, the version should be stored in a way that is transactionally
consistent with the given context
. For instance, in one or more
key-value pairs.
context
- the transaction to use to access the databaseversion
- the new current versiongetCurrentVersionAsync(FDBRecordContext)
default void setCachedMetaData(@Nonnull RecordMetaData metaData)
This cache can be kept in memory. If setCurrentVersion(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext, int)
is supported, it is
still possible to determine when it is out-of-date, even if changed by some other
client.
metaData
- the new cached meta-datagetCachedMetaData()
default void setCachedSerialized(@Nonnull byte[] serialized)
This cache is normally maintained some place that is not transationally consistent.
In which case, if multiple clients can change the meta-data, setCurrentVersion(com.apple.foundationdb.record.provider.foundationdb.FDBRecordContext, int)
should also be supported.
serialized
- the new cached serialized meta-datagetCachedSerialized()