com.ibm.websphere.personalization.resources.cache
Class CacheManager

java.lang.Object
  extended by com.ibm.websphere.personalization.resources.cache.CacheManager

public class CacheManager
extends java.lang.Object

A single place of administration for the Personalization cache. Users may call the invalidate methods of this manager to remove certain items from the cache. Note that since all resource collections are configured to share a WebSphere Dynamic cache map instance by default, clearing one collection may clear all the collections.

To have more granular cache control, users may set up WebSphere Dynamic Cache maps for each resource collection or for groups of collections, and use the PersonalizationService.properties file to configure each collection to use a particular cache map.


Field Summary
static java.lang.String APPLICATION_OBJECT_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String APPLICATION_OBJECT_COLLECTION_NAME
          FOR INTERNAL USE ONLY
static short CACHE_BY_ID
          FOR INTERNAL USE ONLY
static short CACHE_BY_QUERY
          FOR INTERNAL USE ONLY
static java.lang.String CAMPAIGN_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String CAMPAIGN_COLLECTION_NAME
          FOR INTERNAL USE ONLY
static java.lang.String COPYRIGHT
           
static java.lang.String DEFAULT_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String DEFAULT_MAX_RESULTS_TO_CACHE
          FOR INTERNAL USE ONLY
static int DEFAULT_PRIORITY
          FOR INTERNAL USE ONLY
static int DEFAULT_TIMEOUT
          FOR INTERNAL USE ONLY
static java.lang.String defaultPriorityString
           
static java.lang.String defaultTimeoutString
           
static java.lang.Object QUERY_ERROR
           
static java.lang.Object QUERY_RUNNING
           
static long QUERY_TIMEOUT
           
static java.lang.String RESOURCE_COLLECTION_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String RESOURCE_COLLECTION_COLLECTION_NAME
          FOR INTERNAL USE ONLY
static java.lang.String RULE_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String RULE_COLLECTION_NAME
          FOR INTERNAL USE ONLY
static java.lang.String RULE_MAPPING_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String RULE_MAPPING_COLLECTION_NAME
          FOR INTERNAL USE ONLY
static java.lang.String UUID_NODE_TYPE_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String UUID_NODE_TYPE_COLLECTION_NAME
          FOR INTERNAL USE ONLY
static java.lang.String UUID_PATH_CONVERSION_CACHE_NAME
          FOR INTERNAL USE ONLY
static java.lang.String UUID_PATH_CONVERSION_COLLECTION_NAME
          FOR INTERNAL USE ONLY
 
Method Summary
static java.lang.Object get(java.lang.String cacheName, java.lang.String id)
          FOR INTERNAL USE ONLY
static java.lang.Object get(java.lang.String cacheName, java.lang.String id, boolean enableThrottle)
          FOR INTERNAL USE ONLY
static java.lang.String getCacheName(java.lang.String resourceCollectionName, short type)
          FOR INTERNAL USE ONLY
static int getCachePriority(java.lang.String resourceCollectionName)
          FOR INTERNAL USE ONLY
static int getCacheTimeout(java.lang.String resourceCollectionName)
          FOR INTERNAL USE ONLY
protected static java.lang.String getCustomCacheKey(RequestContext reqContext)
          FOR INTERNAL USE ONLY
static java.util.Iterator getIds(java.lang.String cacheName)
          FOR INTERNAL USE ONLY
static int getMaxResultSizeToCache(java.lang.String resourceCollection)
          FOR INTERNAL USE ONLY
static boolean invalidate()
          Invalidate all cache entries which this Personalization server is aware of.
static boolean invalidate(java.lang.String resourceCollection)
          Invalidate all cache entries for queries on the specified resource collection.
static boolean invalidate(java.lang.String resourceCollection, java.lang.String id)
          Invalidate the cache entries for the specified item in the specified resource collection.
static boolean invalidateCacheByName(java.lang.String cacheName)
          Invalidate all cache entries in the specified cache.
static boolean isCacheAvailable()
           
static boolean isCacheEnabled(java.lang.String resourceCollection)
           
static void notifyDone(java.lang.String cacheName, java.lang.String id, boolean resultsFound)
           
static boolean put(java.lang.String cacheName, java.lang.String id, java.io.Serializable value)
          FOR INTERNAL USE ONLY
static boolean put(java.lang.String cacheName, java.lang.String id, java.io.Serializable value, int priority, int timeout)
          FOR INTERNAL USE ONLY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

DEFAULT_CACHE_NAME

public static final java.lang.String DEFAULT_CACHE_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

DEFAULT_PRIORITY

public static int DEFAULT_PRIORITY
FOR INTERNAL USE ONLY


DEFAULT_TIMEOUT

public static int DEFAULT_TIMEOUT
FOR INTERNAL USE ONLY


DEFAULT_MAX_RESULTS_TO_CACHE

public static java.lang.String DEFAULT_MAX_RESULTS_TO_CACHE
FOR INTERNAL USE ONLY


defaultTimeoutString

public static java.lang.String defaultTimeoutString

defaultPriorityString

public static java.lang.String defaultPriorityString

CACHE_BY_QUERY

public static final short CACHE_BY_QUERY
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

CACHE_BY_ID

public static final short CACHE_BY_ID
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

RULE_COLLECTION_NAME

public static final java.lang.String RULE_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

CAMPAIGN_COLLECTION_NAME

public static final java.lang.String CAMPAIGN_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

RULE_MAPPING_COLLECTION_NAME

public static final java.lang.String RULE_MAPPING_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

RESOURCE_COLLECTION_COLLECTION_NAME

public static final java.lang.String RESOURCE_COLLECTION_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

APPLICATION_OBJECT_COLLECTION_NAME

public static final java.lang.String APPLICATION_OBJECT_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

UUID_PATH_CONVERSION_COLLECTION_NAME

public static final java.lang.String UUID_PATH_CONVERSION_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

UUID_NODE_TYPE_COLLECTION_NAME

public static final java.lang.String UUID_NODE_TYPE_COLLECTION_NAME
FOR INTERNAL USE ONLY

See Also:
Constant Field Values

RULE_CACHE_NAME

public static final java.lang.String RULE_CACHE_NAME
FOR INTERNAL USE ONLY


CAMPAIGN_CACHE_NAME

public static final java.lang.String CAMPAIGN_CACHE_NAME
FOR INTERNAL USE ONLY


RULE_MAPPING_CACHE_NAME

public static final java.lang.String RULE_MAPPING_CACHE_NAME
FOR INTERNAL USE ONLY


RESOURCE_COLLECTION_CACHE_NAME

public static final java.lang.String RESOURCE_COLLECTION_CACHE_NAME
FOR INTERNAL USE ONLY


APPLICATION_OBJECT_CACHE_NAME

public static final java.lang.String APPLICATION_OBJECT_CACHE_NAME
FOR INTERNAL USE ONLY


UUID_PATH_CONVERSION_CACHE_NAME

public static final java.lang.String UUID_PATH_CONVERSION_CACHE_NAME
FOR INTERNAL USE ONLY


UUID_NODE_TYPE_CACHE_NAME

public static final java.lang.String UUID_NODE_TYPE_CACHE_NAME
FOR INTERNAL USE ONLY


QUERY_RUNNING

public static final java.lang.Object QUERY_RUNNING

QUERY_ERROR

public static final java.lang.Object QUERY_ERROR

QUERY_TIMEOUT

public static final long QUERY_TIMEOUT
Method Detail

isCacheAvailable

public static boolean isCacheAvailable()
Returns:
if the WebSphere Dynamic cache service is found and the Personalization cache is available. May return false in the Rational test environment if the Dynamic caching service has not been installed.

isCacheEnabled

public static boolean isCacheEnabled(java.lang.String resourceCollection)
Parameters:
resourceCollection -
Returns:
if caching is enabled for the specified resource collection

getMaxResultSizeToCache

public static int getMaxResultSizeToCache(java.lang.String resourceCollection)
FOR INTERNAL USE ONLY


invalidate

public static boolean invalidate(java.lang.String resourceCollection,
                                 java.lang.String id)
Invalidate the cache entries for the specified item in the specified resource collection. This call will in turn call invalidate(resourceCollection) since invalidating a resource may invalidate all queries.

Parameters:
resourceCollection - the collection the id belongs to
id - the item which has become invalid in the cache
Returns:
success

invalidate

public static boolean invalidate(java.lang.String resourceCollection)
Invalidate all cache entries for queries on the specified resource collection. Note that this may not explicitly clear the cache entries for individual resources which are cached by id, but it does clear the cache for all queries on this resource collection.

Parameters:
resourceCollection - the collection which should be invalidated
Returns:
success

invalidate

public static boolean invalidate()
Invalidate all cache entries which this Personalization server is aware of. If a resource collection is used on another server in the cluster and has not been used on this cluster member yet, then this cluster member will not invalidate that collection. For this reason, and because this call will invalidate all cached data, including cached rules and campaigns, the more specific invalidate(String) and invalidate(String, String) methods are preferred.

Returns:
success

invalidateCacheByName

public static boolean invalidateCacheByName(java.lang.String cacheName)
Invalidate all cache entries in the specified cache. Note that this may not explicitly clear the cache entries for individual resources which are cached by id, but it does clear the cache for all queries on this resource collection.

Parameters:
resourceCollection - the collection which should be invalidated
Returns:
success

getCustomCacheKey

protected static java.lang.String getCustomCacheKey(RequestContext reqContext)
FOR INTERNAL USE ONLY


notifyDone

public static void notifyDone(java.lang.String cacheName,
                              java.lang.String id,
                              boolean resultsFound)

get

public static java.lang.Object get(java.lang.String cacheName,
                                   java.lang.String id)
FOR INTERNAL USE ONLY


get

public static java.lang.Object get(java.lang.String cacheName,
                                   java.lang.String id,
                                   boolean enableThrottle)
FOR INTERNAL USE ONLY


getIds

public static java.util.Iterator getIds(java.lang.String cacheName)
FOR INTERNAL USE ONLY


put

public static boolean put(java.lang.String cacheName,
                          java.lang.String id,
                          java.io.Serializable value)
FOR INTERNAL USE ONLY


put

public static boolean put(java.lang.String cacheName,
                          java.lang.String id,
                          java.io.Serializable value,
                          int priority,
                          int timeout)
FOR INTERNAL USE ONLY


getCacheName

public static java.lang.String getCacheName(java.lang.String resourceCollectionName,
                                            short type)
FOR INTERNAL USE ONLY


getCachePriority

public static int getCachePriority(java.lang.String resourceCollectionName)
FOR INTERNAL USE ONLY


getCacheTimeout

public static int getCacheTimeout(java.lang.String resourceCollectionName)
FOR INTERNAL USE ONLY