Interface CachingService

  • All Known Implementing Classes:
    CachingServiceImpl

    public interface CachingService
    A service to manage creation and retrieval of caches.
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String REQUEST_CACHE
      This is the cache key used to stored requests in a request cache, typically handled by a servlet filter but can be handled by anything.
    • Field Detail

      • REQUEST_CACHE

        static final String REQUEST_CACHE
        This is the cache key used to stored requests in a request cache, typically handled by a servlet filter but can be handled by anything. This is here to ensure we use the right name.
        See Also:
        Constant Field Values
    • Method Detail

      • getCaches

        List<Cache> getCaches()
        Gets all the caches that the service knows about. This will include caches of all scopes but only includes request caches for the current thread.
        Returns:
        a list of all the caches which the caching service knows about
      • getCache

        Cache getCache​(String cacheName,
                       CacheConfig cacheConfig)
        Construct a Cache with the given name OR retrieve the one that already exists with this name. Often the name is the fully qualified classpath of the API for the service that is being cached, or of the class if there is no API. This will operate on system defaults (probably a distributed cache without replication) OR it will use the defaults which are configured for this cacheName (part of the underlying implementation) if the cacheConfig is null.

        This can only retrieve request caches for the current request.

        If the cache already exists then the cacheConfig is ignored.

        Parameters:
        cacheName - the unique name for this cache (e.g. org.dspace.user.UserCache)
        cacheConfig - defines the configuration for this cache
        Returns:
        a cache which can be used to store objects
      • destroyCache

        void destroyCache​(String cacheName)
        Flushes and destroys the cache with this name. Generally there is no reason to call this.
        Parameters:
        cacheName - the unique name for this cache (e.g. org.dspace.user.UserCache)
      • getStatus

        String getStatus​(String cacheName)
        Get a status report of cache usage which is suitable for log or screen output.
        Parameters:
        cacheName - (optional) the unique name for this cache (e.g. org.dspace.user.UserCache) OR null for status of all caches
        Returns:
        a string representing the current status of the specified cache or all caches
      • resetCaches

        void resetCaches()
        Clears all caches. Generally there is no reason to call this.
        Throws:
        SecurityException - if the current user does not have super user permissions
      • unbindRequestCaches

        void unbindRequestCaches()
        Unbinds all request caches. Destroys the caches completely. You should not call this unless you know what you are doing; it is handled automatically by the system.