org.pentaho.platform.api.engine
Interface ICacheManager

All Superinterfaces:
ILogoutListener
All Known Implementing Classes:
CacheManager, SimpleMapCacheManager

public interface ICacheManager
extends ILogoutListener


Field Summary
static String GLOBAL
           
static String SESSION
           
 
Method Summary
 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 region
 Set getAllKeysFromRegionCache(String region)
          Get a Set of Key objects from the cache within a specific region
 List getAllValuesFromRegionCache(String region)
          Get a list of values from the cache within a specific region
 Object 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 region
 Object 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 specified IPentahoSession.
 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 region
 void putInSessionCache(IPentahoSession session, String key, Object value)
          Puts an object in the session-specific cache.
 void removeFromGlobalCache(Object key)
          Removes an object from the cache
 void removeFromRegionCache(String region, Object key)
          Removes an object from the cache within a specific region
 void removeFromSessionCache(IPentahoSession session, String key)
          Removes a data item from the user session specific cache
 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
 

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 specified IPentahoSession.

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 IPentahoSession
key - The key by which you want to retrieve the data back out
value - 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 IPentahoSession
key - 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 IPentahoSession
key - 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 indexed
value - 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 interface ILogoutListener
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 region

Important 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 cache
key - Object by which the data is indexed
value - 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 cache
key - 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 cache
key - The key that the data object was stored with