|
Novell exteNd Director 5.2 API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for a cache holder. This interface defines caching methods
for the session-lifetime cache holder (EbiSession
)
and the server-lifetime
cache holder (EbiSrvLifetimeCacheHolder
).
A cache holder can store content in the object cache container or the jointly
managed memory and disk cache containers.
For more about cache containers, see EbiCacheManager
.
A cache holder lets you manage cached content. For the server-lifetime cache, the default cache holder is the global cache holder, which is available as long as the cache is enabled. You can define additional cache holders to provide finer-grained management of cached objects.
Each piece of cached content is called a cache entry, which has an application-defined key and the content itself. The cache holder lets you manipulate cache entries using keys and lets you get a list of keys in use. You can use a single key or a compound key. The compound keys are provided as a convenience to help you organize cached content by object type and component. Director concatenates the parts of the compound key into a single key.
When working with cache entries, it is important to remember that content can be flushed and disappear at any time according to the rules set in the cache configuration. When getting content, always check whether it was successfully returned.
The object, memory, and disk caches are all local to a particular server.
If you are using the cache coordinator in a server cluster,
then when you call methods in EbiSrvLifetimeCacheHolder
to
put content in the cache, you can also trigger cache invalidation
in order to keep the server caches in sync.
caching methods in EbiCacheHolder do not
trigger cache invalidation.
EbiCacheManager
,
EbiCacheEntry
,
EboFactory.getServerLifetimeCacheHolder(String)
Method Summary | |
void |
clearCache(Object key,
boolean flag)
Clears cached content associated with this cache holder in both the object cache and the memory/disk cache. |
void |
clearCache(String objectType)
Clears the cached objects that has the specified object type. |
boolean |
containsContent(Object key)
Checks if content for the specified content key is currently in the cache for this cache holder. |
void |
displayCacheEntries()
Displays the existing cache entries. |
Collection |
getCachedObjects()
Gets all the cached objects for this cache holder from all the cache containers: object, memory and disk. |
Enumeration |
getContentKeys()
Gets an enumeration of keys for the content for this cache holder in all the cache containers: object, memory and disk. |
String |
getIdentifier()
Gets the cache holder's ID. |
int |
getNumberOfCachedEntries()
Gets the number of entries for this cache holder in all the cache containers: object, memory and disk. |
Object |
getObjectInCache(Object key)
Gets a cached object from the object cache. |
Object |
getObjectInCache(String componentKey,
String contentKey)
Gets a cached object that is managed by the object cache container of the cache manager. |
Object |
getObjectInCache(String objectType,
String componentKey,
String contentKey)
Gets a cached object from the object cache using a 3-part key. |
EbiCacheEntry |
getValueInCache(Object key)
Gets cached content from the memory cache or disk cache. |
EbiCacheEntry |
getValueInCache(String objectType,
String contentKey)
Gets a cached value that is managed by the memory/disk cache containers of the cache manager. |
void |
putObjectInCache(Object key,
Object obj)
Puts content in the object cache. |
void |
putObjectInCache(String objectType,
String contentKey,
Object obj)
Puts content in the cache managed by the object cache container of the cache manager. |
void |
putObjectInCache(String objectType,
String componentKey,
String contentKey,
Object obj)
Puts content in the object cache using a 3-part key. |
void |
putValueInCache(Object key,
byte[] data,
boolean useDisk)
Stores a value in the memory/disk cache container of the cache manager with the option of not resorting to disk caching. |
void |
putValueInCache(Object key,
int contentType,
long contentSize,
InputStream in)
Puts content in the memory cache or disk cache. |
void |
removeObjectInCache(Object key)
Removes content associated with this cache holder from the object cache. |
void |
removeObjectInCache(String objectType,
String contentKey)
Removes a cached object that is managed by the object cache container of the cache manager. |
void |
removeObjectInCache(String objectType,
String componentKey,
String contentKey)
Removes content associated with this cache holder from the object cache using a 3-part key. |
void |
removeValueInCache(Object key)
Removes content associated with this cache holder from the memory or disk cache. |
void |
removeValueInCache(String componentKey,
String contentKey)
Removes content associated with this cache holder from the memory or disk cache using a 2-part key. |
void |
setIdentifier(String id)
Sets the cache holder's identifier. |
Method Detail |
public String getIdentifier()
EbiCacheHolder.setIdentifier(String)
.public void setIdentifier(String id)
id
- An ID for the cache holder.public boolean containsContent(Object key)
key
- An Object that serves as a content key.public Enumeration getContentKeys()
public int getNumberOfCachedEntries()
public Collection getCachedObjects()
public Object getObjectInCache(String objectType, String componentKey, String contentKey)
objectType
- Application-defined type of the cached object;
for example, style, page, data.componentKey
- Application-defined key for the component that owns the object.contentKey
- Application-defined content key for the object.public Object getObjectInCache(String componentKey, String contentKey)
objectType
- type of the cached object (style, page, etc.)contentKey
- the content key for the objectpublic Object getObjectInCache(Object key)
key
- Key for the cached object.public EbiCacheEntry getValueInCache(String objectType, String contentKey)
objectType
- type of the cached object (style, page, etc.)contentKey
- the content key for the objectpublic EbiCacheEntry getValueInCache(Object key)
key
- Key for the cached content.public void putObjectInCache(String objectType, String componentKey, String contentKey, Object obj)
objectType
- Application-defined type of the cached object;
for example, style, page, or data.componentKey
- Application-defined key for the component that owns the object.contentKey
- Application-defined content key for the object.obj
- Object to be cached; cannot be null.EbiSrvLifetimeCacheHolder.putObjectInCache(String, String, String, Object, int)
public void putObjectInCache(String objectType, String contentKey, Object obj)
objectType
- Type of the cached object.contentKey
- Application-defined content key for the object.obj
- Object to be cached; cannot be null.#putObjectInCache(String, String, Object, int)
public void putObjectInCache(Object key, Object obj)
key
- Key for the cached content. The key can be any object, not just a String.obj
- The object to be cached; cannot be null.EbiSrvLifetimeCacheHolder.putObjectInCache(Object, Object, int)
public void putValueInCache(Object key, int contentType, long contentSize, InputStream in)
key
- Key for the cached content. The key can be any object, not just a String.contentType
- An integer identifying the content type (text, image, object).
Use these values from
EbiCacheConstants
:
EbiCacheConstants.CACHE_CONTENT_TYPE_TEXT
EbiCacheConstants.CACHE_CONTENT_TYPE_IMAGE
EbiCacheConstants.CACHE_CONTENT_TYPE_OBJECT
contentSize
- Size of the content in bytes.in
- An input stream for the content data.public void putValueInCache(Object key, byte[] data, boolean useDisk)
key
- the content keycontentSize
- the content sizedata
- datauseDisk
- if false, do not attempt to utilize disk cachingpublic void removeObjectInCache(String objectType, String componentKey, String contentKey)
objectType
- Application-defined type of the cached object;
for example, style, page, data.componentKey
- Application-defined key for the component that owns the object.contentKey
- Application-defined content key for the object.public void removeObjectInCache(String objectType, String contentKey)
objectType
- type of the cached object (style, page, etc.)contentKey
- the content key for the objectpublic void removeObjectInCache(Object key)
key
- Key for the cached content.public void removeValueInCache(String componentKey, String contentKey)
componentKey
- Application-defined key for the component that owns the object.contentKey
- Application-defined content key for the object.public void removeValueInCache(Object key)
key
- Key for the cached content.public void clearCache(Object key, boolean flag)
If the flag parameter is set to false, clearCache() searches for keys with an exact match and removes the corresponding content from the cache.
If the flag parameter is set to true:
key
- Key of the contents to be cleared.flag
- Boolean true means use the specified key as a prefix
when matching to keys in the cache.
False means match keys exactly.
When key is null, flag
is ignored and all content is removed.public void clearCache(String objectType)
objectType
- Application-defined object type associated with the cached objects.EbiCacheHolder.putObjectInCache(String, String, String, Object)
public void displayCacheEntries()
|
Novell exteNd Director 5.2 API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |