org.apache.lucene.util.cache
Class Cache<K,V>

java.lang.Object
  extended by org.apache.lucene.util.cache.Cache<K,V>
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
SimpleMapCache

public abstract class Cache<K,V>
extends Object
implements Closeable

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  V get(Object key)
          Returns the value for the given key.
abstract  void put(K key, V value)
          Puts a (key, value)-pair into the cache.
static
<K,V> Cache<K,V>
synchronizedCache(Cache<K,V> 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 <K,V> Cache<K,V> synchronizedCache(Cache<K,V> 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(K key,
                         V value)
Puts a (key, value)-pair into the cache.


get

public abstract V 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.

Specified by:
close in interface Closeable


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