Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.cache.jcache
Interface Cache

public interface Cache
extends java.util.Map

Inner classes inherited from class java.util.Map
`java.util.Map.Entry`

Method Summary
`void` | `addListener(CacheListener listener)` Add a listener to the list of cache listeners
`void` | `clear()` The clear method will remove all objects from the cache including the key and the associated value.
`boolean` | `containsKey(java.lang.Object key)` Returns true if the cache contains the specified key.
`boolean` | `containsValue(java.lang.Object value)` Returns true if this cache maps one or more keys to the specified value.
`java.util.Set` | `entrySet()` Returns a set view of the objects currently contained in the cache.
`boolean` | `equals(java.lang.Object o)` Equality is based on the Set returned by entrySet.
`java.lang.Object` | `get(java.lang.Object key)` The get method will return, from the cache, the object associated with the argument "key".
`CacheEntry` | `getCacheEntry(java.lang.Object key)` Returns the CacheEntry object associated with the object identified by "key".
`CacheStatistics` | `getCacheStatistics()` Returns the CacheStatistics object associated with the cache.
`int` | `getCapacity()`
`long` | `getTTL()`
`int` | `hashCode()` Returns the hash code value for this cache.
`boolean` | `isEmpty()` Return true if entrySet().isEmpty() return true.
`java.util.Set` | `keySet()` Returns a set view of the keys currently contained in the cache.
`void` | `load(java.lang.Object key)` The load method provides a means to "pre load" the cache.
`void` | `loadAll()` This method may be used to preload the cache with all the key value pairs in the cache.
`void` | `loadAll(java.util.Collection keys)` The loadAll method provides a means to "pre load" objects into the cache.
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)` The put method adds the object "value" to the cache identified by the object "key".
`void` | `putAll(java.util.Map t)` Copies all of the mappings from the specified map to the cache.
`java.lang.Object` | `remove(java.lang.Object key)` The remove method will delete the object from the cache including the key and the associated value.
`void` | `removeListener(CacheListener listener)` Remove a listener from the list of cache listeners
`int` | `size()` Returns the size of this map.
`java.util.Collection` | `values()` Returns a collection view of the values contained in this cache.

Method Detail

### containsKey

    public boolean containsKey(java.lang.Object key)

  Returns true if the cache contains the specified key. The search is scoped to the cache. Other caches in the system will not be searched and a CacheLoader will not be called.
  Specified by:
    containsKey in interface java.util.Map

  Parameters:
    `key` - key whose presence in this cache is to be tested.
  Returns:
    true, if the cache contains the specified key.

### containsValue

    public boolean containsValue(java.lang.Object value)

  Returns true if this cache maps one or more keys to the specified value. More formally, returns true if and only if this cache contains at least one mapping to a value v such that (value==null ? v==null : value.equals(v)).
  Specified by:
    containsValue in interface java.util.Map

  Parameters:
    `value` - value whose presence in this cache is to be tested.
  Returns:
    true if the cache contains one or more keys to the specified value.

### entrySet

    public java.util.Set entrySet()

  Returns a set view of the objects currently contained in the cache. A CacheLoader will not be called. The behavior is unspecified for the case when an object is removed from the cache while the return set is being traversed.
  Specified by:
    entrySet in interface java.util.Map

  Returns:
    a set view of the mappings contained in this cache.

### equals

    public boolean equals(java.lang.Object o)

  Equality is based on the Set returned by entrySet. Equal will return true if the two objects are referencing the same object or entrySet.equals(((Map)o).entrySet()) returns true.
  Specified by:
    equals in interface java.util.Map

  Overrides:
    equals in class java.lang.Object

### hashCode

    public int hashCode()

  Returns the hash code value for this cache.
  Specified by:
    hashCode in interface java.util.Map

  Returns:
    the hash code value for this cache.
  Overrides:
    hashCode in class java.lang.Object

### isEmpty

    public boolean isEmpty()

  Return true if entrySet().isEmpty() return true.
  Specified by:
    isEmpty in interface java.util.Map

  Returns:
    true if entrySet().isEmpty() returns true.

### keySet

    public java.util.Set keySet()

  Returns a set view of the keys currently contained in the cache. A CacheLoader will not be called. The behavior is unspecified for the case when an object is remove from the cache while the return set is being traversed.
  Specified by:
    keySet in interface java.util.Map

  Returns:
    a set view of the keys in this cache

### putAll

    public void putAll(java.util.Map t)

  Copies all of the mappings from the specified map to the cache. This would be equivalent to t.entrySet() then iterating through the Set and calling put with each key value pair.
  Specified by:
    putAll in interface java.util.Map

  Parameters:
    `t` - the map whose mappings to be copied to this cache.

### size

    public int size()

  Returns the size of this map.
  Specified by:
    size in interface java.util.Map

  Returns:
    the number of objects in the cache. This should be the same value as entrySet().size();

### values

    public java.util.Collection values()

  Returns a collection view of the values contained in this cache.
  Specified by:
    values in interface java.util.Map

  Returns:
    a collection view of the values contained in this cache.

### get

    public java.lang.Object get(java.lang.Object key)

  The get method will return, from the cache, the object associated with the argument "key". If the object is not in the cache, the associated cache loader will be called. If no loader is associated with the object, a null is returned. The storing of null values in the cache is permitted, however, the get method will not distinguish returning a null stored in the cache and not finding the object in the cache. In both cases a null is returned.
  Specified by:
    get in interface java.util.Map

  Parameters:
    `key` - key whose associated value is to be returned.
  Returns:
    the value to which this cache maps the specified key, or null if the cache contains no mapping for this key.

### load

    public void load(java.lang.Object key)

  The load method provides a means to "pre load" the cache. This method will load the specified object into the cache using the associated cacheloader. If no loader is associated with the object, no object will be loaded into the cache. If a problem is encountered during the retrieving or loading of the object, an exception would be thrown.

  Parameters:
    `key` - key whose associated value to be loaded using the associated cacheloader.
  Throws:
    CacheException -

### loadAll

    public void loadAll(java.util.Collection keys)

  The loadAll method provides a means to "pre load" objects into the cache. This method will load the specified objects into the cache using the associated cache loader. If no loader is associated with the object, no object will be loaded into the cache. If a problem is encountered during the retrieving or loading of the objects, CacheException will be thrown.

  Parameters:
    `keys` - collection of the keys whose associated values to be loaded into this cache by using the associated cacheloader. This collection must not be null
  Throws:
    CacheException -

### loadAll

    public void loadAll()

  This method may be used to preload the cache with all the key value pairs in the cache.

  Throws:
    CacheException - This exception is thrown from the underlying cache loader

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  The put method adds the object "value" to the cache identified by the object "key".
  Specified by:
    put in interface java.util.Map

### getCacheEntry

    public CacheEntry getCacheEntry(java.lang.Object key)

  Returns the CacheEntry object associated with the object identified by "key". If the object is not in the cache a null is returned.

### getCacheStatistics

    public CacheStatistics getCacheStatistics()

  Returns the CacheStatistics object associated with the cache. May return null if the cache does not support statistics gathering.

### remove

    public java.lang.Object remove(java.lang.Object key)

  The remove method will delete the object from the cache including the key and the associated value.
  Specified by:
    remove in interface java.util.Map

### clear

    public void clear()

  The clear method will remove all objects from the cache including the key and the associated value.
  Specified by:
    clear in interface java.util.Map

### addListener

    public void addListener(CacheListener listener)

  Add a listener to the list of cache listeners

### removeListener

    public void removeListener(CacheListener listener)

  Remove a listener from the list of cache listeners

### getCapacity

    public int getCapacity()

  Returns:
    the capacity that this cache has been configured with

### getTTL

    public long getTTL()

  Returns:
    the TTL for entries that this cache has been configured with

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 BEA Systems All Rights Reserved.