Class CacheService


  • public class CacheService
    extends Object
    Provides utility methods for the page cache.
    Author:
    Matthias Herlitzius, Matthias Müller
    • Constructor Detail

      • CacheService

        public CacheService()
    • Method Detail

      • createCacheManager

        public static javax.cache.CacheManager createCacheManager​(com.hazelcast.core.HazelcastInstance instance,
                                                                  boolean isClient)
      • getCacheManager

        public static javax.cache.CacheManager getCacheManager()
        Returns the CacheManager instance.
        Returns:
        The CacheManager instance.
      • getCache

        public static javax.cache.Cache<String,​CachedResponse> getCache​(Site site)
        Returns the Cache instance for the selected Site. Use this method to retrieve a cache instance which already must exists.
        Parameters:
        site - The Site to get the cache for
        Returns:
        The Cache instance for the specified site.
      • clearCache

        public static void clearCache​(Site site)
      • clearStatistics

        public static void clearStatistics​(Site site)
      • createCache

        public static javax.cache.Cache<String,​CachedResponse> createCache​(Site site)
        Returns the Cache instance for the selected Site. Use this method to retrieve a new cache instance. Should be only used in InitializerService
        Parameters:
        site - The site.
        Returns:
        The Cache instance for the specified site.
      • shutdown

        public static void shutdown()
      • expireCacheElement

        public static void expireCacheElement​(Site site,
                                              String cacheElement)
      • expireCacheElementsByPrefix

        public static Future<Integer> expireCacheElementsByPrefix​(Site site,
                                                                  String cacheElementPrefix)
        Expires cache elements by path prefix
        Parameters:
        site - the Site to retrieve the cache for
        cacheElementPrefix - the prefix to use
        Returns:
        a Future holding the number of removed elements
      • expireCacheElementsByPrefix

        public static Future<Integer> expireCacheElementsByPrefix​(javax.cache.Cache<String,​CachedResponse> cache,
                                                                  String cacheElementPrefix)
        Expires cache elements by path prefix
        Parameters:
        cache - the cache to use
        cacheElementPrefix - the prefix to use
        Returns:
        a Future holding the number of removed elements