Class CacheUtils

java.lang.Object
net.solarnetwork.central.support.CacheUtils

public final class CacheUtils extends Object
Utilities for JCache.
  • Constructor Details

    • CacheUtils

      public CacheUtils()
  • Method Details

    • registerCacheEvictionListener

      public static <K, V> void registerCacheEvictionListener(javax.cache.Cache<K,V> cache, CacheUtils.CacheEvictionListener<K,V> listener)
      Register a cache eviction listener if possible.
      Type Parameters:
      K - the cache key type
      V - the cache value type
      Parameters:
      cache - the cache to register the listener on
      listener - the listener to register
    • deregisterCacheEvictionListener

      public static <K, V> void deregisterCacheEvictionListener(javax.cache.Cache<K,V> cache, CacheUtils.CacheEvictionListener<K,V> listener)
      Remove a previously registered cache eviction listener.
      Type Parameters:
      K - the cache key type
      V - the cache value type
      Parameters:
      cache - the cache to remove the listener from
      listener - the listener to remove