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 and 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 and Description
    `CacheService()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `clearCache(Site site)`
    `static void` | `clearStatistics(Site site)`
    `static javax.cache.Cache<String,CachedResponse>` | `createCache(Site site)` Returns the `Cache` instance for the selected `Site`.
    `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 prefix
    `static Future<Integer>` | `expireCacheElementsByPrefix(Site site, String cacheElementPrefix)` Expires cache elements by path prefix
    `static int` | `expireCacheElementsStartingWith(javax.cache.Cache<String,CachedResponse> cache, String cacheElementPrefix)` Deprecated. Use `expireCacheElementsByPrefix(Cache, String)` instead.
    `static int` | `expireCacheElementsStartingWith(Site site, String cacheElementPrefix)` Deprecated. use `expireCacheElementsByPrefix(Cache, String)` instead.
    `static javax.cache.Cache<String,CachedResponse>` | `getCache(Site site)` Returns the `Cache` instance for the selected `Site`.
    `static List<CachedResponse>` | `getCacheEntries(Site site)`
    `static javax.cache.CacheManager` | `getCacheManager()` Returns the `CacheManager` instance.
    `static Map<String,String>` | `getCacheStatistics(Site site)`
    `static void` | `shutdown()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

  - ### 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()

    - #### getCacheStatistics

          public static Map<String,String> getCacheStatistics(Site site)

    - #### expireCacheElement

          public static void expireCacheElement(Site site,
                                                String cacheElement)

    - #### getCacheEntries

          public static List<CachedResponse> getCacheEntries(Site site)

    - #### expireCacheElementsStartingWith

          @Deprecated
          public static int expireCacheElementsStartingWith(Site site,
                                                                        String cacheElementPrefix)

      Deprecated. use `expireCacheElementsByPrefix(Cache, String)` instead.
      Expires cache elements by path prefix
      Parameters:
        `site` - the `Site` to retrieve the cache for
        `cacheElementPrefix` - the prefix to use
      Returns:
        always `0`, as the execution is asynchronous

    - #### expireCacheElementsStartingWith

          @Deprecated
          public static int expireCacheElementsStartingWith(javax.cache.Cache<String,CachedResponse> cache,
                                                                        String cacheElementPrefix)

      Deprecated. Use `expireCacheElementsByPrefix(Cache, String)` instead.
      Expires cache elements by path prefix
      Parameters:
        `cache` - the cache to use
        `cacheElementPrefix` - the prefix to use
      Returns:
        always `0`, as the execution is asynchronous

    - #### 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

    - #### 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

Copyright © 2011–2023 aiticon GmbH. All rights reserved.