org.apache.avalon.excalibur.cache
Class DefaultCache
java.lang.Object
|
+--org.apache.avalon.excalibur.cache.AbstractCache
|
+--org.apache.avalon.excalibur.cache.DefaultCache
- All Implemented Interfaces:
- Cache, org.apache.avalon.framework.component.Component
- Direct Known Subclasses:
- LRUCache, TimeMapLRUCache
- public class DefaultCache
- extends AbstractCache
Default Cache
implementation.
- Author:
- Eung-ju Park
Method Summary |
int |
capacity()
Return capacity of cache. |
void |
clear()
Clear cache. |
boolean |
containsKey(java.lang.Object key)
|
java.lang.Object |
get(java.lang.Object key)
Get an item from the cache. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Puts a new item in the cache. |
java.lang.Object |
remove(java.lang.Object key)
Removes an item from the cache. |
int |
size()
Return size of cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultCache
public DefaultCache(ReplacementPolicy policy,
CacheStore store)
capacity
public int capacity()
- Description copied from interface:
Cache
- Return capacity of cache.
- Following copied from interface:
org.apache.avalon.excalibur.cache.Cache
- Returns:
- capacity of cache
size
public int size()
- Description copied from interface:
Cache
- Return size of cache.
- Following copied from interface:
org.apache.avalon.excalibur.cache.Cache
- Returns:
- the number of key-value mappings in this cache.
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Description copied from interface:
Cache
- Puts a new item in the cache. If the cache is full, remove the selected item.
- Following copied from interface:
org.apache.avalon.excalibur.cache.Cache
- Parameters:
key
- key for the itemvalue
- item- Returns:
- old value. null if old value not exists.
get
public java.lang.Object get(java.lang.Object key)
- Description copied from interface:
Cache
- Get an item from the cache.
- Following copied from interface:
org.apache.avalon.excalibur.cache.Cache
- Parameters:
key
- key to lookup the item- Returns:
- the matching object in the cache. null if item not exists.
remove
public java.lang.Object remove(java.lang.Object key)
- Description copied from interface:
Cache
- Removes an item from the cache.
- Following copied from interface:
org.apache.avalon.excalibur.cache.Cache
- Parameters:
key
- key to remove- Returns:
- the value removed. null if old value not exists.
containsKey
public boolean containsKey(java.lang.Object key)
- Following copied from interface:
org.apache.avalon.excalibur.cache.Cache
- Parameters:
key
- - Returns:
- true if matching item in the cache
clear
public void clear()
- Description copied from interface:
Cache
- Clear cache.
Copyright © 2001 Apache Jakarta Project. All Rights Reserved.