org.castor.cache.simple

Class CountLimited

Implemented Interfaces:
Cache, Map

public final class CountLimited
extends AbstractBaseCache

CountLimited is a count limted least-recently-used Map. Every object being put in the Map will live until the map is full. If the map is full, the least recently used object will be disposed.

The capacity is passed to the cache at initialization by the individual cache property capacity which defines the maximum number of objects the cache can hold. If not specified a default capacity of 30 objects will be used.

Version:
$Revision: 6230 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Authors:
Thomas Yip
Werner Guttmann
Ralf Joachim

Field Summary

static int
DEFAULT_CAPACITY
Default capacity of cache.
static String
PARAM_CAPACITY
Mapped initialization parameter: capacity
static String
TYPE
The type of the cache.

Fields inherited from interface org.castor.cache.Cache

DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE

Method Summary

void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
Set
entrySet()
Object
get(Object key)
int
getCapacity()
Get real capacity of this cache.
String
getType()
void
initialize(Properties params)
boolean
isEmpty()
Set
keySet()
Object
put(Object key, Object value)
void
putAll(Map map)
Object
remove(Object key)
int
size()
Collection
values()

Methods inherited from class org.castor.cache.AbstractBaseCache

close, expire, expireAll, getName, initialize, invokeMethod, invokeStaticMethod

Field Details

DEFAULT_CAPACITY

public static final int DEFAULT_CAPACITY
Default capacity of cache.
Field Value:
30

PARAM_CAPACITY

public static final String PARAM_CAPACITY
Mapped initialization parameter: capacity

TYPE

public static final String TYPE
The type of the cache.

Method Details

clear

public void clear()
See Also:
java.util.Map.clear()

containsKey

public boolean containsKey(Object key)
See Also:
java.util.Map.containsKey(java.lang.Object)

containsValue

public boolean containsValue(Object value)
See Also:
java.util.Map.containsValue(java.lang.Object)

entrySet

public Set entrySet()
See Also:
java.util.Map.entrySet()

get

public Object get(Object key)
See Also:
java.util.Map.get(java.lang.Object)

getCapacity

public int getCapacity()
Get real capacity of this cache.
Returns:
Real capacity of this cache.

getType

public String getType()
Specified by:
getType in interface Cache

initialize

public void initialize(Properties params)
            throws CacheAcquireException
Specified by:
initialize in interface Cache
Overrides:
initialize in interface AbstractBaseCache
See Also:
org.castor.cache.Cache.initialize(java.util.Properties)

isEmpty

public boolean isEmpty()
See Also:
java.util.Map.isEmpty()

keySet

public Set keySet()
See Also:
java.util.Map.keySet()

put

public Object put(Object key,
                  Object value)
See Also:
java.util.Map.put(java.lang.Object, java.lang.Object)

putAll

public void putAll(Map map)
See Also:
java.util.Map.putAll(java.util.Map)

remove

public Object remove(Object key)
See Also:
java.util.Map.remove(java.lang.Object)

size

public int size()
See Also:
java.util.Map.size()

values

public Collection values()
See Also:
java.util.Map.values()

Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com