|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.cache.Cache
A base class for all Caches. Extend this class for other caches.
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
Map.Entry |
| Field Summary | |
protected int |
maxEntrySize
|
| Constructor Summary | |
Cache(int size)
|
|
| Method Summary | |
protected boolean |
checkCachePolicy(Object key)
Checks whether the key object should be cached. |
void |
clear()
|
boolean |
contains(Object key)
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set |
entrySet()
|
boolean |
equals(Object o)
|
Object |
get(Object key)
Like 'get' of Maps but considers if the cache is active or not, and the cache policy of the key. |
int |
getByteSize()
Determines the byte-size of this object |
int |
getByteSize(SizeOf sizeof)
Determines the byte-size of this object using the given SizeOf instance. |
static Cache |
getCache(String name)
|
static Set |
getCaches()
|
int |
getCheapByteSize()
Returns the sum of bytesizes of every key and value. |
int |
getCount(Object key)
|
protected int |
getDefaultMaxEntrySize()
This has to be overridden by Caches which support max entry size. |
String |
getDescription()
Gives a description for this cache type. |
int |
getHits()
Returns the number of times an element was succesfully retrieved from the table. |
int |
getMaxEntrySize()
Return the maximum entry size for the cache in bytes. |
int |
getMisses()
Returns the number of times an element cpould not be retrieved from the table. |
String |
getName()
Returns a name for this cache type. |
int |
getPuts()
Returns the number of times an element was committed to the table. |
double |
getRatio()
Returns the ratio of hits and misses. |
String |
getStats()
Returns statistics on this table. |
static int |
getTotalByteSize()
|
int |
hashCode()
|
boolean |
isActive()
Wether this cache is active or not. |
boolean |
isEmpty()
|
Set |
keySet()
|
static void |
main(String[] args)
|
int |
maxSize()
|
Object |
put(Object key,
Object value)
Like 'put' of LRUHashtable but considers if the cache is active or not. |
void |
putAll(Map t)
|
Cache |
putCache()
Puts this cache in the caches repository. |
protected static Cache |
putCache(Cache cache)
|
Object |
remove(Object key)
|
void |
setActive(boolean a)
Sets this cache to active or passive. |
void |
setMaxSize(int size)
|
int |
size()
|
String |
toString()
|
Collection |
values()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int maxEntrySize
| Constructor Detail |
public Cache(int size)
| Method Detail |
public String getName()
public String getDescription()
public int getMaxEntrySize()
protected int getDefaultMaxEntrySize()
public Set entrySet()
entrySet in interface Mapprotected boolean checkCachePolicy(Object key)
false if either the current cache is inactive, or the object to cache
has a cache policy associated that prohibits caching of the object.
key - the object to be cached
true if the object can be cachedpublic Object get(Object key)
get in interface Map
public Object put(Object key,
Object value)
put in interface Mappublic int getHits()
public int getMisses()
public int getPuts()
public void setMaxSize(int size)
public int maxSize()
public int size()
size in interface MapMap.size()public boolean contains(Object key)
public int getCount(Object key)
public double getRatio()
public String getStats()
public void setActive(boolean a)
public String toString()
public final boolean isActive()
public int getByteSize()
SizeMeasurable
getByteSize in interface SizeMeasurablepublic int getByteSize(SizeOf sizeof)
SizeMeasurable
getByteSize in interface SizeMeasurablepublic int getCheapByteSize()
getByteSize(), which has to keep a Collection of every counted object.
public void clear()
clear in interface MapMap.clear()public boolean containsKey(Object key)
containsKey in interface MapMap.containsKey(java.lang.Object)public boolean containsValue(Object value)
containsValue in interface MapMap.containsValue(java.lang.Object)public boolean equals(Object o)
equals in interface MapMap.equals(java.lang.Object)public int hashCode()
hashCode in interface MapMap.hashCode()public boolean isEmpty()
isEmpty in interface MapMap.isEmpty()public Set keySet()
keySet in interface MapMap.keySet()public void putAll(Map t)
putAll in interface MapMap.putAll(java.util.Map)public Object remove(Object key)
remove in interface MapMap.remove(java.lang.Object)public Collection values()
values in interface MapMap.values()public Cache putCache()
CacheManager.putCache(Cache)protected static Cache putCache(Cache cache)
CacheManager.getCache(String)public static Cache getCache(String name)
CacheManager.getCache(String)public static Set getCaches()
CacheManager.getCaches()public static int getTotalByteSize()
CacheManager.getTotalByteSize()public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||