Class InMemoryCachingManagerImpl

java.lang.Object
growthbook.sdk.java.sandbox.InMemoryCachingManagerImpl
All Implemented Interfaces:
GbCacheManager

public class InMemoryCachingManagerImpl extends Object implements GbCacheManager
Simple process-lifetime in-memory cache manager.
  • Constructor Details

    • InMemoryCachingManagerImpl

      public InMemoryCachingManagerImpl()
  • Method Details

    • saveContent

      public void saveContent(String key, String data)
      Specified by:
      saveContent in interface GbCacheManager
    • loadCache

      public String loadCache(String key)
      Specified by:
      loadCache in interface GbCacheManager
    • getLastUpdatedMillis

      public Long getLastUpdatedMillis(String key)
      Description copied from interface: GbCacheManager
      Returns when the cached value was last updated, in epoch milliseconds.

      The optional background feature refresh interval uses this timestamp to decide whether cached features are fresh enough to skip a network refresh. Custom cache implementations may return null when timestamp tracking is unsupported or when the key does not exist; in that case the SDK treats cache freshness as unknown and performs the network refresh. Implementations should throw FeatureCacheException for real cache access failures.

      Specified by:
      getLastUpdatedMillis in interface GbCacheManager
    • clearCache

      public void clearCache()
      Specified by:
      clearCache in interface GbCacheManager