org.mentawai.cache
Class AbstractCache

java.lang.Object
  extended by org.mentawai.cache.AbstractCache
All Implemented Interfaces:
java.io.Serializable, Cache
Direct Known Subclasses:
FIFOCache, LRUCache, TimeoutCache

public abstract class AbstractCache
extends java.lang.Object
implements Cache, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  int capacity
           
protected  int hits
           
protected static float LOAD
           
protected  java.util.Map<java.lang.Object,java.lang.Object> map
           
protected  int misses
           
protected  java.lang.String name
           
protected  java.util.Date startDate
           
 
Constructor Summary
AbstractCache(java.lang.String name, int capacity)
           
AbstractCache(java.lang.String name, int capacity, float load)
           
 
Method Summary
 void clear()
           
protected abstract  java.util.Map<java.lang.Object,java.lang.Object> createMap(int initialCapacity, float load)
           
 java.lang.Object get(java.lang.Object key)
           
 int getSize()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOAD

protected static final float LOAD
See Also:
Constant Field Values

name

protected java.lang.String name

map

protected java.util.Map<java.lang.Object,java.lang.Object> map

capacity

protected int capacity

misses

protected transient volatile int misses

hits

protected transient volatile int hits

startDate

protected transient java.util.Date startDate
Constructor Detail

AbstractCache

public AbstractCache(java.lang.String name,
                     int capacity)

AbstractCache

public AbstractCache(java.lang.String name,
                     int capacity,
                     float load)
Method Detail

createMap

protected abstract java.util.Map<java.lang.Object,java.lang.Object> createMap(int initialCapacity,
                                                                              float load)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface Cache

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface Cache

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface Cache

clear

public void clear()
Specified by:
clear in interface Cache

getSize

public int getSize()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2005 Mentawai Team. All Rights Reserved.