org.opengts.extra.util
Interface MemCacheAPI<KEY,VAL>

All Known Implementing Classes:
MemCache, MemCache.MemCacheMap

public interface MemCacheAPI<KEY,VAL>

Memory cache handler interface


Method Summary
 void addValue(KEY key, VAL val)
          Add entry to cache
 int getMaximumCacheSize()
          Gets the maximum cache size
 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 maxSize)
          Sets the maximum cache size
 

Method Detail

setMaximumCacheSize

int setMaximumCacheSize(int maxSize)
Sets the maximum cache size

Parameters:
maxSize - The maximum cache size
Returns:
The set maximum cache size, or -1 if unable to set the size.

getMaximumCacheSize

int getMaximumCacheSize()
Gets the maximum cache size

Returns:
The maximum cache size, or -1 if unable to retrieve the size.

addValue

void addValue(KEY key,
              VAL val)
Add entry to cache

Parameters:
key - The key to add
val - The value to associate with the specified key

hasValue

boolean hasValue(KEY key)
Returns true if the specified key exists in the cache

Parameters:
key - The key to check for existence
Returns:
True if the specified key exists in the cache, false otherwise

getValue

VAL getValue(KEY key,
             VAL dft)
Get entry from cache

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