Interface MetaDataCache


  • @API(EXPERIMENTAL)
    public interface MetaDataCache
    A caching hook for 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.

    • Method Detail

      • getCurrentVersionAsync

        default CompletableFuture<Integer> getCurrentVersionAsync​(FDBRecordContext context)
        Get a version to use for cache validation of -1 to skip validation.
        Parameters:
        context - the transaction to use to access the database
        Returns:
        a future that completes with the current version
      • getCachedSerialized

        @Nullable
        default byte[] getCachedSerialized()
        Get cached serialized meta-data. For instance, from Memcache.
        Returns:
        any cached serialized form
      • setCurrentVersion

        default void setCurrentVersion​(FDBRecordContext context,
                                       int version)
        Update the version used for cache validation.

        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.

        Parameters:
        context - the transaction to use to access the database
        version - the new current version
        See Also:
        getCurrentVersionAsync(FDBRecordContext)