org.apache.jetspeed.cache
Interface JetspeedCache

All Known Subinterfaces:
JetspeedContentCache

public interface JetspeedCache

Provides interface to Jetspeed for cache related activities Abstraction around actual cache implementation

Version:
$Id: $
Author:
David Sean Taylor

Method Summary
 void addEventListener(JetspeedCacheEventListener listener, boolean local)
          Add a cache listener for supported cache events, either for local or remote cache events
 void clear()
          clear all content in the cache
 ContentCacheKey createCacheKey(RequestContext rc, java.lang.String windowId)
          Create a portlet content cache key based on dynamic request context information and a window id
 CacheElement createElement(java.lang.Object key, java.lang.Object content)
          Create a cached element
 void evictContentForSession(java.lang.String sessionId)
          Evict all cached content for the given session identifier
 void evictContentForUser(java.lang.String username)
          Evict all cached content for the given username
 CacheElement get(java.lang.Object key)
          Retrieve an object from the cache
 java.util.List getKeys()
          Returns a list of all elements in the cache, whether or not they are expired.
 int getMaxSize()
          get the maximum size of the cache
 int getSize()
          get the size of the cache
 int getTimeToIdleSeconds()
           
 int getTimeToLiveSeconds()
           
 boolean isDistributed()
          Returns whether this cache is currently part of a distributed cache cluster.
 boolean isKeyInCache(java.lang.Object key)
           
 void put(CacheElement object)
          Put an object into the cache, adding it, or replacing if exists
 boolean remove(java.lang.Object key)
          Remove an object from the cache
 void removeEventListener(JetspeedCacheEventListener listener, boolean local)
           
 boolean removeQuiet(java.lang.Object key)
          Remove object from cache, do not notify listeners
 

Method Detail

get

CacheElement get(java.lang.Object key)
Retrieve an object from the cache

Parameters:
key - The key used to find the object
Returns:
the found object or null

clear

void clear()
clear all content in the cache


put

void put(CacheElement object)
Put an object into the cache, adding it, or replacing if exists

Parameters:
object -

createElement

CacheElement createElement(java.lang.Object key,
                           java.lang.Object content)
Create a cached element

Parameters:
key -
content -
Returns:

isKeyInCache

boolean isKeyInCache(java.lang.Object key)

remove

boolean remove(java.lang.Object key)
Remove an object from the cache

Parameters:
key -
Returns:
true if the object was removed, false otherwise

removeQuiet

boolean removeQuiet(java.lang.Object key)
Remove object from cache, do not notify listeners

Parameters:
key -
Returns:
trie if the object was removed, false otherwise

getTimeToIdleSeconds

int getTimeToIdleSeconds()
Returns:
the default idle time in seconds for this cache

getTimeToLiveSeconds

int getTimeToLiveSeconds()
Returns:
the default idle time in seconds for this cache

evictContentForUser

void evictContentForUser(java.lang.String username)
Evict all cached content for the given username

Parameters:
username - unique user identifier

evictContentForSession

void evictContentForSession(java.lang.String sessionId)
Evict all cached content for the given session identifier

Parameters:
sessionid - unique session identifier

createCacheKey

ContentCacheKey createCacheKey(RequestContext rc,
                               java.lang.String windowId)
Create a portlet content cache key based on dynamic request context information and a window id

Parameters:
rc -
windowId -
Returns:
Since:
2.1.2

addEventListener

void addEventListener(JetspeedCacheEventListener listener,
                      boolean local)
Add a cache listener for supported cache events, either for local or remote cache events

Parameters:
listener -
local - if true, listen to local events, if false, listen to remote

removeEventListener

void removeEventListener(JetspeedCacheEventListener listener,
                         boolean local)

getKeys

java.util.List getKeys()
Returns a list of all elements in the cache, whether or not they are expired. The returned keys are unique and can be considered a set.

Returns:
the list of keys

getSize

int getSize()
get the size of the cache

Returns:
the size of the cache

isDistributed

boolean isDistributed()
Returns whether this cache is currently part of a distributed cache cluster.

Returns:
distributed flag

getMaxSize

int getMaxSize()
get the maximum size of the cache

Returns:
the maximum size of the cache


Copyright © 1999-2011 The Apache Software Foundation. All Rights Reserved.