01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.cache;
11:
12: import java.util.*;
13:
14: /**
15: * Classes which can be used as a cache implementation need to implement this interface.
16: * An implementation of this interface has to be thread-safe to guarantee correctness.
17: *
18: * @author Michiel Meeuwissen
19: * @version $Id: CacheImplementationInterface.java,v 1.9 2007/08/10 07:53:52 michiel Exp $
20: * @since MMBase-1.8
21: */
22: public interface CacheImplementationInterface<K, V> extends Map<K, V> {
23:
24: /**
25: * Sets the (maximal) size of the cache (if implementable).
26: */
27: void setMaxSize(int size);
28:
29: /**
30: * Gets the (maximal) size of the cache (if implementable)
31: */
32: int maxSize();
33:
34: /**
35: * Returns the hit-count on a certain key (if implementable, -1 otherwise).
36: */
37: int getCount(K key);
38:
39: /**
40: * Configure the implementation with the given configuration values
41: */
42: void config(Map<String, String> configuration);
43:
44: }
|