Interface CacheableService<K,V>
- Type Parameters:
K- the type of keys maintained by the cacheV- 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
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 TypeMethodDescriptionvoidenableCache(boolean bEnable) Enables or disables the cache.intGets the number of items currently in the cache.getInfos()Returns cache information.getKeys()Gets all keys in the cache.default intDeprecated.default longDeprecated.default longDeprecated.booleanGets the current cache status.booleanCan the cache be reset by automatic caches resetsdefault booleanCan 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 booleanIs the cache required by the webapp: it holds data that are not read again elsewhere (the loaded plugins, a notification shared by the instances...).voidResets 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
Gets all keys in the cache.- Returns:
- a list of all keys in the cache
-
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 theCacheStatisticsMXBean.- Returns:
- the maximum number of elements
-
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 theCacheStatisticsMXBean.- Returns:
- the time to live in seconds
-
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 theCacheStatisticsMXBean.- 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
-