com.sun.mdm.index.query
Class QueryObjectCachePool

java.lang.Object
  extended bycom.sun.mdm.index.query.QueryObjectCachePool

public class QueryObjectCachePool
extends java.lang.Object

QueryObjectCachePool, based on LinkedHashMap This cache has a fixed maximum number of elements (poolSize). If the cache pool has reached its maximum size and another entry is added, the LRU (least recently used) entry is removed.


Constructor Summary
QueryObjectCachePool(int poolSize)
          Creates a new LRU cache.
 
Method Summary
 void clear()
          Clears the cache.
 QueryObjectCache get(QueryObject key)
          Retrieves a QueryObjectCache from the pool
 java.util.Collection getAll()
          Returns a Collection that contains a copy of all cache entries.
 void put(QueryObject key, QueryObjectCache value)
          Adds an entry to this cache.
 int usedEntries()
          Returns the number of used entries in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryObjectCachePool

public QueryObjectCachePool(int poolSize)
Creates a new LRU cache.

Method Detail

clear

public void clear()
Clears the cache.


get

public QueryObjectCache get(QueryObject key)
Retrieves a QueryObjectCache from the pool

Parameters:
key - the key of the QueryObjectCache to be returned.
Returns:
the QueryObjectCache, or null if no QueryObjectCache with this key exists in the pool.

getAll

public java.util.Collection getAll()
Returns a Collection that contains a copy of all cache entries.

Returns:
a Collection with a copy of the cache content.

put

public void put(QueryObject key,
                QueryObjectCache value)
Adds an entry to this cache. If the cache is full, the LRU (least recently used) entry is dropped.

Parameters:
key - the key with which the specified value is to be associated.
value - a value to be associated with the specified key.

usedEntries

public int usedEntries()
Returns the number of used entries in the cache.

Returns:
the number of entries currently in the cache.


Sun Microsystems, Inc.