Interface ICacheService


public interface ICacheService
  • Method Summary

    Modifier and Type
    Method
    Description
    <K, V> javax.cache.Cache<K,V>
    getCache(String cacheName)
    Looks up a managed Cache given its name.
    void
    Registers a new CacheableService
    void
    Shutdown the cache service and the cache manager.
  • Method Details

    • getCache

      <K, V> javax.cache.Cache<K,V> getCache(String cacheName)
      Looks up a managed Cache given its name.

      Use this method to check runtime key and value types.

      Use getCache(String) where this check is not required.

      Implementations must ensure that the key and value types are the same as those configured for the Cache prior to returning from this method.

      Implementations may further perform type checking on mutative cache operations and throw a ClassCastException if these checks fail.

      Implementations that support declarative mechanisms for pre-configuring Caches may return a pre-configured Cache instead of null.

      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      cacheName - the name of the managed Cache to acquire
      keyType - the expected Class of the key
      valueType - the expected Class of the value
      Returns:
      the Cache or null if it does exist or can't be pre-configured
      Throws:
      IllegalStateException - if the CacheManager is #isClosed()
      ClassCastException - if the specified key and/or value types are incompatible with the configured cache.
      NullPointerException - if either keyType or classType is null.
      SecurityException - when the operation could not be performed due to the current security settings
    • shutdown

      void shutdown()
      Shutdown the cache service and the cache manager. Should be called when the webapp is stopped.
    • registerCacheableService

      void registerCacheableService(CacheableService<?,?> cs)
      Registers a new CacheableService
      Parameters:
      cs - The CacheableService