Interface ICache

All Superinterfaces:
IComponent, IInitializable
All Known Subinterfaces:
IAliasCache, IClassCache, IDBCache, IDependentCache, IThingCache, ITimedCache

public interface ICache extends IComponent
Title: Description:

Public interface to the cache.

Cache entries can be any java object.

Cache entries are identified by a cache entry primary key, which can be any java object that properly implements the equals() and hashcode() methods.

Copyright: Copyright (c) 2001 Company:
  • Field Details

  • Method Details

    • put

      void put(ICacheKey key, long maxAge, Object data)
      Put an entry into the cache. If the entry doesn't exist this will create one.
      Parameters:
      key - cache key
      maxAge - maximum age of entry, 0 means no maximum age
      data - the data to cache
    • getEntry

      ICacheEntry getEntry(ICacheKey key)
      Gets the entry from the cache. Note that this entry is writable and changes may persist locally. However any changes will probably not affect any other boxes in the cluster. It's not recommended to write to the entry.
      Parameters:
      key - cache key
      Returns:
      the entry, null if the entry doesn't exist, is invalid, or has expired
    • getValue

      Object getValue(ICacheKey key)
      Gets just the value from the entry.
      Parameters:
      key - cache key
      Returns:
      Object in cache or null if not cached, invalid or expired
    • getModified

      long getModified(ICacheKey key)
      this enables the CacheInvalThread to check for invalidated cache entries without loading the whole entry The modified date should come from the transient cache impl
      Parameters:
      key - cache key
      Returns:
      modified date or 0 if not found
    • flush

      void flush(ICacheKey key)
      Remove entries that match primary key.
      Parameters:
      key - cache key
    • refresh

      void refresh(ICacheKey key, boolean refreshLocal)
      refreshes all cache entries..intended for in-memory caches.
      Parameters:
      key - primary of the entry
      refreshLocal - true if you want to refresh local cache
    • update

      void update(ICacheKey key)
      Inform the cache that the object specified by key has changed.
      Parameters:
      key - primary of the entry
    • isClustered

      boolean isClustered()
      true iff you want events sent/received to all machines in the cluster should be part of the basic cache metadata
      Returns:
    • getName

      String getName()
      name of cache
    • getSize

      int getSize()
      Number of items in cache
    • getMaxSize

      int getMaxSize()
      maximum number of items in the cache
    • getReport

      String getReport(int detailLevel, boolean sendtoLog)
      Generates a text report on the status of the cache. Contents of the report are dependent on implementation.
      Parameters:
      detailLevel - optional number defined by implementation
      sendtoLog - if true, send result to the log
    • createKey

      ICacheKey createKey(int keyA, int keyB, String keyName, int secondKey)
      creates a standary key from the 4 sub keys. The primary key is generated by creating a hashcode of A,B, and Name. The secondary key is used to support entries with the same primary key but with different objects that need to be cached (pages etc)
      Parameters:
      keyA - Key A
      keyB - Key B
      keyName - Key Name
      secondKey - Secondary Key
      Returns:
      cache key
    • createKey

      ICacheKey createKey(int primaryKey)
      Specify the primary key directly. Should be similar to a hashcode.
      Parameters:
      primaryKey - Primary Key
    • createKey

      ICacheKey createKey()
      Creates an empty key. Call the set methods to initialize it.
    • flushAll

      void flushAll(boolean flushRemote) throws CacheException
      flushes all entries from the cache
      Throws:
      CacheException
    • flushAll

      void flushAll(String[] valueClassNames, boolean flushRemote) throws CacheException
      Flushes only entries which store values of specified classes
      Parameters:
      valueClassNames -
      flushRemote -
      Throws:
      CacheException
    • getCacheManager

      ICacheManager getCacheManager()
      gets the manager for this cache
      Returns: