Class CaffeineCache<T,U>

java.lang.Object
com.inrupt.client.caffeine.CaffeineCache<T,U>
Type Parameters:
T - the key type
U - the value type
All Implemented Interfaces:
ClientCache<T,U>

public class CaffeineCache<T,U> extends Object implements ClientCache<T,U>
A cache implementation using Caffeine.
  • Constructor Details

    • CaffeineCache

      public CaffeineCache(com.github.benmanes.caffeine.cache.Cache<T,U> cache)
      Wrap an existing caffeine Cache.
      Parameters:
      cache - the caffeine cache
  • Method Details

    • get

      public U get(T key)
      Description copied from interface: ClientCache
      Retrieve a cached value.
      Specified by:
      get in interface ClientCache<T,U>
      Parameters:
      key - the key
      Returns:
      the cached value, may be null if not present
    • put

      public void put(T key, U value)
      Description copied from interface: ClientCache
      Set a cached value.
      Specified by:
      put in interface ClientCache<T,U>
      Parameters:
      key - the key, not null
      value - the value, not null
    • invalidate

      public void invalidate(T key)
      Description copied from interface: ClientCache
      Invalidate a single cached value.
      Specified by:
      invalidate in interface ClientCache<T,U>
      Parameters:
      key - the key, not null
    • invalidateAll

      public void invalidateAll()
      Description copied from interface: ClientCache
      Invalidate all values in the cache.
      Specified by:
      invalidateAll in interface ClientCache<T,U>