Interface CacheManager<T>


public interface CacheManager<T>
  • Method Details

    • init

      void init(String pluginType)
      Initialize cache for pluginType
      Parameters:
      pluginType - pluginType
    • get

      Optional<T> get(String key)
      Returns a populated #Optional if the value exists, otherwise Optional.empty().
      Parameters:
      key - key
      Returns:
      The return value.
    • put

      Optional<T> put(String key, T value)
      Populate a cache with value.
      Parameters:
      key - key
      value - value
      Returns:
      The return value is previous value.
    • get

      T get(String key, Function<String,T> loader)
      Get or load a value by supplying a key and function. The function is provided an #Optional, representing the existing value, if any.
      Parameters:
      key - key
      loader - loader
      Returns:
      existing or new value
    • get

      T get(String key, BiFunction<String,T,T> loader)
      Get or load a value by supplying a key, value, and function. The bi function can access existing value and produce new value from it.
      Parameters:
      key - key
      loader - bi function loader
      Returns:
      null if key is not present, otherwise return new value
    • invalidate

      Optional<T> invalidate(String key)
      Invalidates, or removes the associated cache entry.
      Parameters:
      key - key
      Returns:
      Returns a populated #Optional if the entry existed, otherwise Optional.empty().
    • contains

      boolean contains(String key)
      Clear plugins cache.
      Parameters:
      key - key
      Returns:
      boolean value indicating whether cache contains key or not
    • clear

      void clear()
      clear plugins cache