org.opengts.extra.util
Class MemCache.MemCacheMap<KEY,VAL>

java.lang.Object
  extended by org.opengts.extra.util.MemCache.MemCacheMap<KEY,VAL>
All Implemented Interfaces:
MemCacheAPI<KEY,VAL>
Enclosing class:
MemCache<KEY,VAL>

public class MemCache.MemCacheMap<KEY,VAL>
extends java.lang.Object
implements MemCacheAPI<KEY,VAL>

Class MemCachMap


Constructor Summary
MemCache.MemCacheMap()
           
MemCache.MemCacheMap(int maxSize)
           
 
Method Summary
 void addValue(KEY key, VAL val)
          Add entry to cache
 boolean exceedsMaximumCacheSize(double maxGain)
           
 int getMaximumCacheSize()
          Gets the maximum cache size
 int getMaximumCacheSizeCutbackCount()
           
 long getMaximumEntryAgeMS()
           
 int getSize()
           
 int getTrimCacheSize()
           
 VAL getValue(KEY key, VAL dft)
          Get entry from cache
 boolean hasValue(KEY key)
          Returns true if the specified key exists in the cache
 int setMaximumCacheSize(int max)
          Sets the maximum cache size
 long setMaximumEntryAgeMS(long max)
           
 int setTrimCacheSize(int min)
           
 java.lang.String toString()
           
 void trimCache(java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemCache.MemCacheMap

public MemCache.MemCacheMap()

MemCache.MemCacheMap

public MemCache.MemCacheMap(int maxSize)
Method Detail

getMaximumCacheSize

public int getMaximumCacheSize()
Description copied from interface: MemCacheAPI
Gets the maximum cache size

Specified by:
getMaximumCacheSize in interface MemCacheAPI<KEY,VAL>
Returns:
The maximum cache size, or -1 if unable to retrieve the size.

setMaximumCacheSize

public int setMaximumCacheSize(int max)
Description copied from interface: MemCacheAPI
Sets the maximum cache size

Specified by:
setMaximumCacheSize in interface MemCacheAPI<KEY,VAL>
Parameters:
max - The maximum cache size
Returns:
The set maximum cache size, or -1 if unable to set the size.

exceedsMaximumCacheSize

public boolean exceedsMaximumCacheSize(double maxGain)

getTrimCacheSize

public int getTrimCacheSize()

setTrimCacheSize

public int setTrimCacheSize(int min)

getMaximumCacheSizeCutbackCount

public int getMaximumCacheSizeCutbackCount()

getMaximumEntryAgeMS

public long getMaximumEntryAgeMS()

setMaximumEntryAgeMS

public long setMaximumEntryAgeMS(long max)

getSize

public int getSize()

hasValue

public boolean hasValue(KEY key)
Description copied from interface: MemCacheAPI
Returns true if the specified key exists in the cache

Specified by:
hasValue in interface MemCacheAPI<KEY,VAL>
Parameters:
key - The key to check for existence
Returns:
True if the specified key exists in the cache, false otherwise

addValue

public void addValue(KEY key,
                     VAL val)
Description copied from interface: MemCacheAPI
Add entry to cache

Specified by:
addValue in interface MemCacheAPI<KEY,VAL>
Parameters:
key - The key to add
val - The value to associate with the specified key

getValue

public VAL getValue(KEY key,
                    VAL dft)
Description copied from interface: MemCacheAPI
Get entry from cache

Specified by:
getValue in interface MemCacheAPI<KEY,VAL>
Parameters:
key - The key of the value to retrieve
dft - The default value if the key does not exist
Returns:
The value for the specified key, or specified default if the key does not exist

trimCache

public void trimCache(java.lang.String msg)

toString

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