SAP NetWeaver '04

com.sapportals.wcm.util.cache
Interface ICache

[contained in: com.sap.netweaver.bc.util.par - bc.util.public_api.jar]
public interface ICache

Generic cache interface.


Field Summary
static boolean DEFAULT_AUTO_DELAY_EXPIRATION
           
static long DEFAULT_AVG_ENTRY_SIZE
           
static java.lang.String DEFAULT_CACHE_CLASS
           
static java.lang.String DEFAULT_CACHE_TYPE
           
static int DEFAULT_CAPACITY
           
static boolean DEFAULT_CLEAR_CACHE_ON_INIT
           
static java.lang.String DEFAULT_FILE_PREFIX
           
static java.lang.String DEFAULT_FOLDER
           
static long DEFAULT_MAX_CACHE_SIZE
           
static long DEFAULT_MAX_ENTRY_SIZE
           
static boolean DEFAULT_SECURE
           
static boolean DEFAULT_SINGLETON
           
static java.lang.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(java.lang.String key, java.lang.Object object)
          create a new entry and add it to the cache
 void addEntry(java.lang.String key, java.lang.Object object, int timeToLive)
          create a new entry and add it to the cache
 void addEntry(java.lang.String key, java.lang.Object object, int timeToLive, long size)
          create a new entry and add it to the cache
 void addEntryAutoDelay(java.lang.String key, java.lang.Object object, int timeToLive)
          create a new entry and add it to the cache - on access the expiration is delayed by timeToLive
 void addEntryAutoDelay(java.lang.String key, java.lang.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(java.lang.String key)
          check, whether an entry with the key is stored in the cache
 CacheEntryList elements()
           
 int getCapacity()
           
 ICacheEntry getEntry(java.lang.String key)
          get an entry from the cache
 java.lang.String getID()
          get the cache ID
 long getMaxEntrySize()
           
 java.util.Enumeration keys()
          Deprecated. as of NW04. Use keySet() instead
 java.util.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(java.lang.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(java.lang.String key)
          remove an entry from the cache
 

Field Detail

DEFAULT_CACHE_TYPE

public static final java.lang.String DEFAULT_CACHE_TYPE

DEFAULT_CACHE_CLASS

public static final java.lang.String DEFAULT_CACHE_CLASS

DEFAULT_CAPACITY

public static final int DEFAULT_CAPACITY

DEFAULT_MAX_CACHE_SIZE

public static final long DEFAULT_MAX_CACHE_SIZE

DEFAULT_MAX_ENTRY_SIZE

public static final long DEFAULT_MAX_ENTRY_SIZE

DEFAULT_AVG_ENTRY_SIZE

public static final long DEFAULT_AVG_ENTRY_SIZE

DEFAULT_TIME_TO_LIVE

public static final int DEFAULT_TIME_TO_LIVE

DEFAULT_STORAGE_CLASS

public static final java.lang.String DEFAULT_STORAGE_CLASS

DEFAULT_FOLDER

public static final java.lang.String DEFAULT_FOLDER

DEFAULT_FILE_PREFIX

public static final java.lang.String DEFAULT_FILE_PREFIX

DEFAULT_SECURE

public static final boolean DEFAULT_SECURE

DEFAULT_CLEAR_CACHE_ON_INIT

public static final boolean DEFAULT_CLEAR_CACHE_ON_INIT

DEFAULT_SINGLETON

public static final boolean DEFAULT_SINGLETON

DEFAULT_AUTO_DELAY_EXPIRATION

public static final boolean DEFAULT_AUTO_DELAY_EXPIRATION
Method Detail

addEntry

public 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

public void addEntry(java.lang.String key,
                     java.lang.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

public void addEntry(java.lang.String key,
                     java.lang.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

public void addEntryAutoDelay(java.lang.String key,
                              java.lang.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

public void addEntry(java.lang.String key,
                     java.lang.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

public void addEntryAutoDelay(java.lang.String key,
                              java.lang.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

public java.lang.String getID()
get the cache ID
Returns:
the cache ID

getEntry

public ICacheEntry getEntry(java.lang.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

public 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

public boolean removeEntry(java.lang.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

public boolean removeEntriesStartingWith(java.lang.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

public 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

containsEntry

public boolean containsEntry(java.lang.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

public java.util.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

public java.util.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

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

clearCache

public void clearCache()
                throws CacheException
remove all entries from the cache
Throws:
CacheException - Exception raised in failure situation

refresh

public void refresh()
             throws CacheException
remove all expired entries
Throws:
CacheException - Exception raised in failure situation

getCapacity

public int getCapacity()
Returns:
the capacity of the cache

getMaxEntrySize

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

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.