com.sapportals.wcm.util.cache

Interface ICache


public interface ICache

Generic cache interface.


Field Summary
static boolean DEFAULT_AUTO_DELAY_EXPIRATION
           
static long DEFAULT_AVG_ENTRY_SIZE
           
static String DEFAULT_CACHE_CLASS
           
static String DEFAULT_CACHE_TYPE
           
static int DEFAULT_CAPACITY
           
static boolean DEFAULT_CLEAR_CACHE_ON_INIT
           
static String DEFAULT_FILE_PREFIX
           
static String DEFAULT_FOLDER
           
static long DEFAULT_MAX_CACHE_SIZE
           
static long DEFAULT_MAX_ENTRY_SIZE
           
static boolean DEFAULT_SECURE
           
static boolean DEFAULT_SINGLETON
           
static String DEFAULT_STORAGE_CLASS
           
static int DEFAULT_TIME_TO_LIVE
           
 
Method Summary
 void addEntry(ICacheEntry entry)
          add a new entry to the cache
 void addEntry(String key, Object object)
          create a new entry and add it to the cache
 void addEntry(String key, Object object, int timeToLive)
          create a new entry and add it to the cache
 void addEntry(String key, Object object, int timeToLive, long size)
          create a new entry and add it to the cache
 void addEntryAutoDelay(String key, Object object, int timeToLive)
          create a new entry and add it to the cache - on access the expiration is delayed by timeToLive
 void addEntryAutoDelay(String key, Object object, int timeToLive, long size)
          create a new entry and add it to the cache - on access the expiration is delayed by timeToLive
 void clearCache()
          remove all entries from the cache
 boolean containsEntry(String key)
          check, whether an entry with the key is stored in the cache
 CacheEntryList elements()
           
 int getCapacity()
           
 ICacheEntry getEntry(String key)
          get an entry from the cache
 String getID()
          get the cache ID
 long getMaxEntrySize()
           
 Enumeration keys()
          Deprecated. as of NW04. Use keySet() instead
 Set keySet()
          Returns a setview on the current set of keys of all entries.
 void refresh()
          remove all expired entries
 boolean removeEntriesOlderThan(long timestamp)
          remove all entries from the cache with modification date older than the given timestamp.
 boolean removeEntriesStartingWith(String prefix)
          remove all entries from the cache which's keys start with a specific prefix
 boolean removeEntry(ICacheEntry entry)
          remove an entry from the cache
 boolean removeEntry(String key)
          remove an entry from the cache
 

Field Detail

DEFAULT_CACHE_TYPE

static final String DEFAULT_CACHE_TYPE
See Also:
Constant Field Values

DEFAULT_CACHE_CLASS

static final String DEFAULT_CACHE_CLASS
See Also:
Constant Field Values

DEFAULT_CAPACITY

static final int DEFAULT_CAPACITY
See Also:
Constant Field Values

DEFAULT_MAX_CACHE_SIZE

static final long DEFAULT_MAX_CACHE_SIZE
See Also:
Constant Field Values

DEFAULT_MAX_ENTRY_SIZE

static final long DEFAULT_MAX_ENTRY_SIZE
See Also:
Constant Field Values

DEFAULT_AVG_ENTRY_SIZE

static final long DEFAULT_AVG_ENTRY_SIZE
See Also:
Constant Field Values

DEFAULT_TIME_TO_LIVE

static final int DEFAULT_TIME_TO_LIVE
See Also:
Constant Field Values

DEFAULT_STORAGE_CLASS

static final String DEFAULT_STORAGE_CLASS
See Also:
Constant Field Values

DEFAULT_FOLDER

static final String DEFAULT_FOLDER
See Also:
Constant Field Values

DEFAULT_FILE_PREFIX

static final String DEFAULT_FILE_PREFIX
See Also:
Constant Field Values

DEFAULT_SECURE

static final boolean DEFAULT_SECURE
See Also:
Constant Field Values

DEFAULT_CLEAR_CACHE_ON_INIT

static final boolean DEFAULT_CLEAR_CACHE_ON_INIT
See Also:
Constant Field Values

DEFAULT_SINGLETON

static final boolean DEFAULT_SINGLETON
See Also:
Constant Field Values

DEFAULT_AUTO_DELAY_EXPIRATION

static final boolean DEFAULT_AUTO_DELAY_EXPIRATION
See Also:
Constant Field Values
Method Detail

addEntry

void addEntry(ICacheEntry entry)
              throws CacheException
add a new entry to the cache

Parameters:
entry - new entry
Throws:
CacheException - Exception raised in failure situation

addEntry

void addEntry(String key,
              Object object)
              throws CacheException
create a new entry and add it to the cache

Parameters:
key - key of the new entry
object - object of the new entry
Throws:
CacheException - Exception raised in failure situation

addEntry

void addEntry(String key,
              Object object,
              int timeToLive)
              throws CacheException
create a new entry and add it to the cache

Parameters:
key - key of the new entry
object - object of the new entry
timeToLive - after this time (in seconds) the entry is removed from the cache
Throws:
CacheException - Exception raised in failure situation

addEntryAutoDelay

void addEntryAutoDelay(String key,
                       Object object,
                       int timeToLive)
                       throws CacheException
create a new entry and add it to the cache - on access the expiration is delayed by timeToLive

Parameters:
key - key of the new entry
object - object of the new entry
timeToLive - after this time (in seconds) the entry is removed from the cache
Throws:
CacheException - Exception raised in failure situation

addEntry

void addEntry(String key,
              Object object,
              int timeToLive,
              long size)
              throws CacheException
create a new entry and add it to the cache

Parameters:
key - key of the new entry
object - object of the new entry
timeToLive - after this time (in seconds) the entry is removed from the cache
size - supposed size of the object (in bytes) (may be ignored in persistent caches)
Throws:
CacheException - Exception raised in failure situation

addEntryAutoDelay

void addEntryAutoDelay(String key,
                       Object object,
                       int timeToLive,
                       long size)
                       throws CacheException
create a new entry and add it to the cache - on access the expiration is delayed by timeToLive

Parameters:
key - key of the new entry
object - object of the new entry
timeToLive - after this time (in seconds) the entry is removed from the cache
size - supposed size of the object (in bytes) (may be ignored in persistent caches)
Throws:
CacheException - Exception raised in failure situation

getID

String getID()
get the cache ID

Returns:
the cache ID

getEntry

ICacheEntry getEntry(String key)
                     throws CacheException
get an entry from the cache

Parameters:
key - key of the entry
Returns:
entry or null if no entry with the key is stored in the cache
Throws:
CacheException - Exception raised in failure situation

removeEntry

boolean removeEntry(ICacheEntry entry)
                    throws CacheException
remove an entry from the cache

Parameters:
entry - entry to be removed
Returns:
true iff the entry was found and removed
Throws:
CacheException - Exception raised in failure situation

removeEntry

boolean removeEntry(String key)
                    throws CacheException
remove an entry from the cache

Parameters:
key - key of the entry
Returns:
true iff an entry was found and removed
Throws:
CacheException - Exception raised in failure situation

removeEntriesStartingWith

boolean removeEntriesStartingWith(String prefix)
                                  throws CacheException
remove all entries from the cache which's keys start with a specific prefix

Parameters:
prefix - TBD: Description of the incoming method parameter
Returns:
true iff at least one entry was found and removed
Throws:
CacheException - Exception raised in failure situation

removeEntriesOlderThan

boolean removeEntriesOlderThan(long timestamp)
                               throws CacheException
remove all entries from the cache with modification date older than the given timestamp.

Parameters:
timestamp - the compare the modification dates with
Returns:
true if at least one entry was found and removed
Throws:
CacheException

containsEntry

boolean containsEntry(String key)
                      throws CacheException
check, whether an entry with the key is stored in the cache

Parameters:
key - key of the entry
Returns:
TBD: Description of the outgoing return value
Throws:
CacheException - Exception raised in failure situation

keys

Enumeration keys()
                 throws CacheException
Deprecated. as of NW04. Use keySet() instead

Returns:
enumeration of the keys of all entries in the cache
Throws:
CacheException - Exception raised in failure situation

keySet

Set keySet()
           throws CacheException
Returns a setview on the current set of keys of all entries. For safe iteration over the set, either synchronize the cache or make a copy of the set.

Returns:
set view on keys of all entries in the cache
Throws:
CacheException - Exception raised in failure situation

elements

CacheEntryList elements()
                        throws CacheException
Returns:
list of all cache entries
Throws:
CacheException - Exception raised in failure situation

clearCache

void clearCache()
                throws CacheException
remove all entries from the cache

Throws:
CacheException - Exception raised in failure situation

refresh

void refresh()
             throws CacheException
remove all expired entries

Throws:
CacheException - Exception raised in failure situation

getCapacity

int getCapacity()
Returns:
the capacity of the cache

getMaxEntrySize

long getMaxEntrySize()
Returns:
the maximum entry size of the cache in bytes
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice