Interface CacheLoaderWriterProvider

All Superinterfaces:
Service

public interface CacheLoaderWriterProvider extends Service
A Service that creates CacheLoaderWriter instances.

A CacheManager will use the createCacheLoaderWriter(java.lang.String, org.ehcache.config.CacheConfiguration) method to create CacheLoaderWriter instances for each Cache it manages.

For any non null value returned, the Cache will be configured to use the CacheLoaderWriter instance returned.

  • Method Details

    • createCacheLoaderWriter

      <K, V> CacheLoaderWriter<? super K,V> createCacheLoaderWriter(String alias, CacheConfiguration<K,V> cacheConfiguration)
      Creates a CacheLoaderWriter for use with the Cache of the given alias and configuration.
      Type Parameters:
      K - the loader-writer key type
      V - the loader-writer value type
      Parameters:
      alias - the Cache alias in the CacheManager
      cacheConfiguration - the configuration for the associated cache
      Returns:
      the CacheLoaderWriter to be used by the Cache or null if none
    • releaseCacheLoaderWriter

      void releaseCacheLoaderWriter(String alias, CacheLoaderWriter<?,?> cacheLoaderWriter) throws Exception
      Releases a CacheLoaderWriter when the associated Cache is finished with it.

      If the CacheLoaderWriter instance was user provided close will not be invoked.

      Parameters:
      alias - the Cache alias in the CacheManager
      cacheLoaderWriter - the CacheLoaderWriter being released
      Throws:
      Exception - when the release fails
    • getPreConfiguredCacheLoaderWriterConfig

      CacheLoaderWriterConfiguration<?> getPreConfiguredCacheLoaderWriterConfig(String alias)
      Returns preconfigured CacheLoaderWriterConfiguration for the given alias
      Parameters:
      alias - the Cache alias in the CacheManager
      Returns:
      CacheLoaderWriterConfiguration configured for the Cache, otherwise null
    • isLoaderJsrProvided

      boolean isLoaderJsrProvided(String alias)
      Checks whether CacheLoaderWriter was provided using jsr api
      Parameters:
      alias - the Cache alias in the CacheManager
      Returns:
      true if CacheLoaderWriter was provided using jsr api, otherwise false.