Package org.ehcache

Interface UserManagedCache<K,​V>

  • Type Parameters:
    K - the key type for the cache
    V - the value type for the cache
    All Superinterfaces:
    java.lang.AutoCloseable, Cache<K,​V>, java.io.Closeable, java.lang.Iterable<Cache.Entry<K,​V>>
    All Known Subinterfaces:
    PersistentUserManagedCache<K,​V>

    public interface UserManagedCache<K,​V>
    extends Cache<K,​V>, java.io.Closeable
    Represents a Cache that is not managed by a CacheManager.

    These caches must be closed in order to release all their resources.

    • Method Detail

      • init

        void init()
           throws StateTransitionException
        Transitions this UserManagedCache to AVAILABLE.

        If an error occurs before the UserManagedCache is AVAILABLE, it will revert to UNINITIALIZED and attempt to properly release all resources.

        Throws:
        java.lang.IllegalStateException - if the UserManagedCache is not UNINITIALIZED
        StateTransitionException - if the UserManagedCache could not be made AVAILABLE
      • close

        void close()
            throws StateTransitionException
        Transitions this UserManagedCache to UNINITIALIZED.

        This will release all resources held by this cache.

        Failure to release a resource will not prevent other resources from being released.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        StateTransitionException - if the UserManagedCache could not reach UNINITIALIZED cleanly
        java.lang.IllegalStateException - if the UserManagedCache is not AVAILABLE
      • getStatus

        Status getStatus()
        Returns the current Status of this UserManagedCache.
        Returns:
        the current Status