Package org.pentaho.platform.api.engine
Interface ICacheManager
- All Superinterfaces:
ILogoutListener
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
addCacheRegion
(String region) boolean
addCacheRegion
(String region, Properties cacheProperties) boolean
Returns the enablement state of the cache.boolean
cacheEnabled
(String region) Returns the enablement state of the cache.void
Stops the cache by calling the cacheProvider stop method.void
Entirely clears the cache.void
clearRegionCache
(String region) Clears any data for the specified for a specific region(For example region could be session, global etc)getAllEntriesFromRegionCache
(String region) Get a Set of Map.Entry objects from the cache within a specific regiongetAllKeysFromRegionCache
(String region) Get a Set of Key objects from the cache within a specific regiongetAllValuesFromRegionCache
(String region) Get a list of values from the cache within a specific regionlong
Counts the items in the global cachelong
getElementCountInRegionCache
(String region) Counts the items in the region cachelong
Counts the items in the session cachegetFromGlobalCache
(Object key) Gets an object from the cache without translating the passed in key.getFromRegionCache
(String region, Object key) Gets an object from the cache within a specific regiongetFromSessionCache
(IPentahoSession session, String key) Gets an object from the user session specific cache.void
killSessionCache
(IPentahoSession session) Removes any session-based data for the specifiedIPentahoSession
.void
Removes all cached items that are session-based.void
onLogout
(IPentahoSession session) void
putInGlobalCache
(Object key, Object value) Puts an object directly into the cache without translating the passed in key.void
putInRegionCache
(String reqion, Object key, Object value) Puts an object directly into the cache of a specific regionvoid
putInSessionCache
(IPentahoSession session, String key, Object value) Puts an object in the session-specific cache.void
Removes an object from the cachevoid
removeFromRegionCache
(String region, Object key) Removes an object from the cache within a specific regionvoid
removeFromSessionCache
(IPentahoSession session, String key) Removes a data item from the user session specific cachevoid
removeRegionCache
(String region) Clears any data for the specified for a specific region(For example region could be session, global etc) and removed the region from the map
-
Field Details
-
SESSION
- See Also:
-
GLOBAL
- See Also:
-
-
Method Details
-
cacheStop
void cacheStop()Stops the cache by calling the cacheProvider stop method. This method should be called either when the VM goes away, or when the web context goes away. This performs required cleanup in the underlying cache implementation. In some cases, failure to stop the cache will cause cached items saved to disk to be un-recoverable. -
killSessionCache
Removes any session-based data for the specifiedIPentahoSession
.- Parameters:
session
- The session whose objects needs to be removed from the cache.
-
killSessionCaches
void killSessionCaches()Removes all cached items that are session-based. -
putInSessionCache
Puts an object in the session-specific cache. The session specified must have a valid session id.Take special care that, in a TestCase, you don't have multiple StandaloneSession objects with the same session key. Consider using
UUIDUtil
to generate a unique sessionId for each standalone session.- Parameters:
session
- The users IPentahoSessionkey
- The key by which you want to retrieve the data back outvalue
- The data item to place into the cache
-
clearCache
void clearCache()Entirely clears the cache. -
removeFromSessionCache
Removes a data item from the user session specific cache- Parameters:
session
- The users IPentahoSessionkey
- The key that maps to the value needing removed
-
getFromSessionCache
Gets an object from the user session specific cache. If the object doesn't exist in the cache, null is returned.- Parameters:
session
- The users IPentahoSessionkey
- The key that maps to the data to get from the cache- Returns:
- Object that was stored in the cache
-
cacheEnabled
boolean cacheEnabled()Returns the enablement state of the cache.- Returns:
- true if the cache has been initialized and is ready for use.
-
putInGlobalCache
Puts an object directly into the cache without translating the passed in key.Important note - most cache implementations require both the key and the value to be serializable.
- Parameters:
key
- Object by which the data is indexedvalue
- The data to store in the cache.
-
getFromGlobalCache
Gets an object from the cache without translating the passed in key.- Parameters:
key
- The key that the data object was stored with- Returns:
- The corresponding data object
-
removeFromGlobalCache
Removes an object from the cache- Parameters:
key
- The key that the data object was stored with
-
cacheEnabled
Returns the enablement state of the cache.- Returns:
- true if the cache has been initialized and is ready for use.
-
onLogout
- Specified by:
onLogout
in interfaceILogoutListener
- Parameters:
session
- Performs any logout actions based on this session.
-
addCacheRegion
-
addCacheRegion
-
clearRegionCache
Clears any data for the specified for a specific region(For example region could be session, global etc)- Parameters:
region
- The region whose objects needs to be removed from the cache.
-
removeRegionCache
Clears any data for the specified for a specific region(For example region could be session, global etc) and removed the region from the map- Parameters:
region
- The region whose objects needs to be removed from the cache.
-
putInRegionCache
Puts an object directly into the cache of a specific regionImportant note - most cache implementations require both the key and the value to be serializable.
- Parameters:
region
- the region where the object will be put in the cachekey
- Object by which the data is indexedvalue
- The data to store in the cache.
-
getFromRegionCache
Gets an object from the cache within a specific region- Parameters:
region
- the region where the object was put in the cachekey
- The key that the data object was stored with- Returns:
- The corresponding data object
-
getAllEntriesFromRegionCache
Get a Set of Map.Entry objects from the cache within a specific region- Parameters:
region
- the region where the object was put in the cache- Returns:
- The corresponding list of objects
-
getAllKeysFromRegionCache
Get a Set of Key objects from the cache within a specific region- Parameters:
region
- the region where the object was put in the cache- Returns:
- The corresponding list of objects
-
getAllValuesFromRegionCache
Get a list of values from the cache within a specific region- Parameters:
region
- the region where the object was put in the cache- Returns:
- The corresponding list of objects
-
removeFromRegionCache
Removes an object from the cache within a specific region- Parameters:
region
- the region where the object was put in the cachekey
- The key that the data object was stored with
-
getElementCountInRegionCache
Counts the items in the region cache- Parameters:
region
-- Returns:
- Number of elements in the region cache
-
getElementCountInSessionCache
long getElementCountInSessionCache()Counts the items in the session cache- Parameters:
region
-- Returns:
- Number of elements in the session cache
-
getElementCountInGlobalCache
long getElementCountInGlobalCache()Counts the items in the global cache- Parameters:
region
-- Returns:
- Number of elements in the global cache
-