org.apache.lucene.util.cache
Class Cache

java.lang.Object
  extended by org.apache.lucene.util.cache.Cache
Direct Known Subclasses:
SimpleMapCache

public abstract class Cache
extends Object

Base class for cache implementations.


Constructor Summary
Cache()
           
 
Method Summary
abstract  void close()
          Closes the cache.
abstract  boolean containsKey(Object key)
          Returns whether the given key is in this cache.
abstract  Object get(Object key)
          Returns the value for the given key.
abstract  void put(Object key, Object value)
          Puts a (key, value)-pair into the cache.
static Cache synchronizedCache(Cache cache)
          Returns a thread-safe cache backed by the specified cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Method Detail

synchronizedCache

public static Cache synchronizedCache(Cache cache)
Returns a thread-safe cache backed by the specified cache. In order to guarantee thread-safety, all access to the backed cache must be accomplished through the returned cache.


put

public abstract void put(Object key,
                         Object value)
Puts a (key, value)-pair into the cache.


get

public abstract Object get(Object key)
Returns the value for the given key.


containsKey

public abstract boolean containsKey(Object key)
Returns whether the given key is in this cache.


close

public abstract void close()
Closes the cache.



Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.