org.mmbase.cache
Interface CacheImplementationInterface<K,V>

All Superinterfaces:
Map<K,V>
All Known Implementing Classes:
LRUCache, LRUHashtable, MultilevelCacheHandler, OSCacheImplementation

public interface CacheImplementationInterface<K,V>
extends Map<K,V>

Classes which can be used as a cache implementation need to implement this interface. An implementation of this interface has to be thread-safe to guarantee correctness.

Since:
MMBase-1.8
Version:
$Id: CacheImplementationInterface.java 34900 2009-05-01 16:29:42Z michiel $
Author:
Michiel Meeuwissen

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 void config(Map<String,String> configuration)
          Configure the implementation with the given configuration values
 int getCount(K key)
          Returns the hit-count on a certain key (if implementable, -1 otherwise).
 Object getLock()
          The cache implementation must be somehow thread-safe.
 int maxSize()
          Gets the (maximal) size of the cache (if implementable)
 void setMaxSize(int size)
          Sets the (maximal) size of the cache (if implementable).
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

setMaxSize

void setMaxSize(int size)
Sets the (maximal) size of the cache (if implementable).


maxSize

int maxSize()
Gets the (maximal) size of the cache (if implementable)


getCount

int getCount(K key)
Returns the hit-count on a certain key (if implementable, -1 otherwise).


config

void config(Map<String,String> configuration)
Configure the implementation with the given configuration values


getLock

Object getLock()
The cache implementation must be somehow thread-safe. This method should return the object on which to synchronize, e.g. when looping over entrySet.

Since:
MMBase-1.8.6


MMBase 2.0-SNAPSHOT - null