Package org.pentaho.platform.api.engine
Interface ICacheManager
-
- All Superinterfaces:
ILogoutListener
public interface ICacheManager extends ILogoutListener
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addCacheRegion(String region)
boolean
addCacheRegion(String region, Properties cacheProperties)
boolean
cacheEnabled()
Returns the enablement state of the cache.boolean
cacheEnabled(String region)
Returns the enablement state of the cache.void
cacheStop()
Stops the cache by calling the cacheProvider stop method.void
clearCache()
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)Set
getAllEntriesFromRegionCache(String region)
Get a Set of Map.Entry objects from the cache within a specific regionSet
getAllKeysFromRegionCache(String region)
Get a Set of Key objects from the cache within a specific regionList
getAllValuesFromRegionCache(String region)
Get a list of values from the cache within a specific regionlong
getElementCountInGlobalCache()
Counts the items in the global cachelong
getElementCountInRegionCache(String region)
Counts the items in the region cachelong
getElementCountInSessionCache()
Counts the items in the session cacheObject
getFromGlobalCache(Object key)
Gets an object from the cache without translating the passed in key.Object
getFromRegionCache(String region, Object key)
Gets an object from the cache within a specific regionObject
getFromSessionCache(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
killSessionCaches()
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
removeFromGlobalCache(Object key)
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 Detail
-
SESSION
static final String SESSION
- See Also:
- Constant Field Values
-
GLOBAL
static final String GLOBAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void killSessionCache(IPentahoSession session)
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
void putInSessionCache(IPentahoSession session, String key, Object value)
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
void removeFromSessionCache(IPentahoSession session, String key)
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
Object getFromSessionCache(IPentahoSession session, String key)
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
void putInGlobalCache(Object key, Object value)
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
Object getFromGlobalCache(Object key)
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
void removeFromGlobalCache(Object key)
Removes an object from the cache- Parameters:
key
- The key that the data object was stored with
-
cacheEnabled
boolean cacheEnabled(String region)
Returns the enablement state of the cache.- Returns:
- true if the cache has been initialized and is ready for use.
-
onLogout
void onLogout(IPentahoSession session)
- Specified by:
onLogout
in interfaceILogoutListener
- Parameters:
session
- Performs any logout actions based on this session.
-
addCacheRegion
boolean addCacheRegion(String region)
-
addCacheRegion
boolean addCacheRegion(String region, Properties cacheProperties)
-
clearRegionCache
void clearRegionCache(String region)
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
void 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- Parameters:
region
- The region whose objects needs to be removed from the cache.
-
putInRegionCache
void putInRegionCache(String reqion, Object key, Object value)
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
Object getFromRegionCache(String region, Object key)
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
Set getAllEntriesFromRegionCache(String region)
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
Set getAllKeysFromRegionCache(String region)
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
List getAllValuesFromRegionCache(String region)
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
void removeFromRegionCache(String region, Object key)
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
long getElementCountInRegionCache(String region)
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
-
-