Class MemoryCacheEngine

java.lang.Object
dev.voidframework.cache.engine.MemoryCacheEngine
All Implemented Interfaces:
CacheEngine

@BindClass public final class MemoryCacheEngine extends Object implements CacheEngine
In-memory cache implementation.
  • Constructor Details

    • MemoryCacheEngine

      @Inject public MemoryCacheEngine(com.typesafe.config.Config configuration)
      Build a new instance.
      Parameters:
      configuration - The application configuration
  • Method Details

    • get

      public Object get(String cacheKey)
      Description copied from interface: CacheEngine
      Retrieves a value from cache.
      Specified by:
      get in interface CacheEngine
      Parameters:
      cacheKey - The key
      Returns:
      The value, otherwise, null
    • set

      public void set(String cacheKey, Object value, int timeToLive)
      Description copied from interface: CacheEngine
      Set a value to the cache.
      Specified by:
      set in interface CacheEngine
      Parameters:
      cacheKey - The key
      value - The value
      timeToLive - Retention time (in seconds)