Interface CacheableService<K,V>

Type Parameters:
K - the type of keys maintained by the cache
V - the type of cached values
All Superinterfaces:
LuteceService
All Known Subinterfaces:
Lutece107Cache<K,V>
All Known Implementing Classes:
AbstractCacheableService, BaseUserPreferencesCacheService, Default107Cache, LinksIncludeCacheService, LuteceUserCacheService, PageCacheService, PathCacheService, PortletCacheService, ResourceService

public interface CacheableService<K,V> extends LuteceService
Base interface of Lutece services that provide a cache. Uses the JCache API to make cache statistics available via the CacheStatisticsMXBean.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    enableCache(boolean bEnable)
    Enables or disables the cache.
    int
    Gets the number of items currently in the cache.
    Returns cache information.
    Gets all keys in the cache.
    default int
    Deprecated.
    default long
    Deprecated.
    default long
    Deprecated.
    boolean
    Gets the current cache status.
    boolean
    Can the cache be reset by automatic caches resets
    default boolean
    Can the cache be emptied: a cache whose entries cannot be rebuilt on a cache miss is never reset, neither by a global reset nor by its own reset.
    default boolean
    Is the cache required by the webapp: it holds data that are not read again elsewhere (the loaded plugins, a notification shared by the instances...).
    void
    Resets the cache.

    Methods inherited from interface fr.paris.lutece.portal.service.util.LuteceService

    getName
  • Method Details

    • isCacheEnable

      boolean isCacheEnable()
      Gets the current cache status.
      Returns:
      true if the cache is enabled, otherwise false
    • getCacheSize

      int getCacheSize()
      Gets the number of items currently in the cache.
      Returns:
      the number of items currently in the cache
    • resetCache

      void resetCache()
      Resets the cache.
    • enableCache

      void enableCache(boolean bEnable)
      Enables or disables the cache.
      Parameters:
      bEnable - true to enable, false to disable
    • getKeys

      List<K> getKeys()
      Gets all keys in the cache.
      Returns:
      a list of all keys in the cache
    • getMaxElements

      @Deprecated default int getMaxElements()
      Deprecated.
      Returns the maximum number of elements accepted into the cache. This method will be removed in the next version: Use the JCache API to make cache statistics available via the CacheStatisticsMXBean.
      Returns:
      the maximum number of elements
    • getTimeToLive

      @Deprecated default long getTimeToLive()
      Deprecated.
      Returns the time to live for objects in the cache. This method will be removed in the next version: Use the JCache API to make cache statistics available via the CacheStatisticsMXBean.
      Returns:
      the time to live in seconds
    • getMemorySize

      @Deprecated default long getMemorySize()
      Deprecated.
      Returns the memory size of the cache. This method will be removed in the next version: Use the JCache API to make cache statistics available via the CacheStatisticsMXBean.
      Returns:
      the memory size
    • getInfos

      String getInfos()
      Returns cache information.
      Returns:
      cache information
    • isPreventGlobalReset

      boolean isPreventGlobalReset()
      Can the cache be reset by automatic caches resets
      Returns:
      true is the cache can be reset by automatic / massive caches resets, false otherwise
    • isRequired

      default boolean isRequired()
      Is the cache required by the webapp: it holds data that are not read again elsewhere (the loaded plugins, a notification shared by the instances...). A required cache is always enabled, whatever the status saved in the database or chosen in the back office.
      Returns:
      true if the cache can never be disabled
    • isPreventReset

      default boolean isPreventReset()
      Can the cache be emptied: a cache whose entries cannot be rebuilt on a cache miss is never reset, neither by a global reset nor by its own reset.
      Returns:
      true if the cache can never be reset