Package org.appng.core.service
Class CacheService
- java.lang.Object
-
- org.appng.core.service.CacheService
-
public class CacheService extends Object
Provides utility methods for the page cache.- Author:
- Matthias Herlitzius, Matthias Müller
-
-
Field Summary
Fields Modifier and Type Field Description static String
DASH
static String
PAGE_CACHE
static String
STATS_AVG_GET_TIME
static String
STATS_AVG_PUT_TIME
static String
STATS_AVG_REMOVAL_TIME
static String
STATS_GETS
static String
STATS_HITS
static String
STATS_HITS_PERCENT
static String
STATS_MISSES
static String
STATS_MISSES_PERCENT
static String
STATS_NAME
static String
STATS_PUTS
static String
STATS_REMOVALS
static String
STATS_SIZE
-
Constructor Summary
Constructors Constructor Description CacheService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearCache(Site site)
static void
clearStatistics(Site site)
static javax.cache.Cache<String,CachedResponse>
createCache(Site site)
Returns theCache
instance for the selectedSite
.static javax.cache.CacheManager
createCacheManager(com.hazelcast.core.HazelcastInstance instance, boolean isClient)
static void
expireCacheElement(Site site, String cacheElement)
static Future<Integer>
expireCacheElementsByPrefix(javax.cache.Cache<String,CachedResponse> cache, String cacheElementPrefix)
Expires cache elements by path prefixstatic Future<Integer>
expireCacheElementsByPrefix(Site site, String cacheElementPrefix)
Expires cache elements by path prefixstatic javax.cache.Cache<String,CachedResponse>
getCache(Site site)
Returns theCache
instance for the selectedSite
.static List<CachedResponse>
getCacheEntries(Site site)
static javax.cache.CacheManager
getCacheManager()
Returns theCacheManager
instance.static Map<String,String>
getCacheStatistics(Site site)
static void
shutdown()
-
-
-
Field Detail
-
PAGE_CACHE
public static final String PAGE_CACHE
- See Also:
- Constant Field Values
-
DASH
public static final String DASH
- See Also:
- Constant Field Values
-
STATS_NAME
public static final String STATS_NAME
- See Also:
- Constant Field Values
-
STATS_SIZE
public static final String STATS_SIZE
- See Also:
- Constant Field Values
-
STATS_PUTS
public static final String STATS_PUTS
- See Also:
- Constant Field Values
-
STATS_GETS
public static final String STATS_GETS
- See Also:
- Constant Field Values
-
STATS_REMOVALS
public static final String STATS_REMOVALS
- See Also:
- Constant Field Values
-
STATS_HITS
public static final String STATS_HITS
- See Also:
- Constant Field Values
-
STATS_HITS_PERCENT
public static final String STATS_HITS_PERCENT
- See Also:
- Constant Field Values
-
STATS_MISSES
public static final String STATS_MISSES
- See Also:
- Constant Field Values
-
STATS_MISSES_PERCENT
public static final String STATS_MISSES_PERCENT
- See Also:
- Constant Field Values
-
STATS_AVG_PUT_TIME
public static final String STATS_AVG_PUT_TIME
- See Also:
- Constant Field Values
-
STATS_AVG_GET_TIME
public static final String STATS_AVG_GET_TIME
- See Also:
- Constant Field Values
-
STATS_AVG_REMOVAL_TIME
public static final String STATS_AVG_REMOVAL_TIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createCacheManager
public static javax.cache.CacheManager createCacheManager(com.hazelcast.core.HazelcastInstance instance, boolean isClient)
-
getCacheManager
public static javax.cache.CacheManager getCacheManager()
Returns theCacheManager
instance.- Returns:
- The
CacheManager
instance.
-
getCache
public static javax.cache.Cache<String,CachedResponse> getCache(Site site)
Returns theCache
instance for the selectedSite
. Use this method to retrieve a cache instance which already must exists.- Parameters:
site
- TheSite
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 theCache
instance for the selectedSite
. Use this method to retrieve a new cache instance. Should be only used inInitializerService
- Parameters:
site
- The site.- Returns:
- The
Cache
instance for the specified site.
-
shutdown
public static void shutdown()
-
getCacheEntries
public static List<CachedResponse> getCacheEntries(Site site)
-
expireCacheElementsByPrefix
public static Future<Integer> expireCacheElementsByPrefix(Site site, String cacheElementPrefix)
Expires cache elements by path prefix
-
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 usecacheElementPrefix
- the prefix to use- Returns:
- a
Future
holding the number of removed elements
-
-