com.thimbleware.jmemcached
Class LRUCacheStorageDelegate

java.lang.Object
  extended by com.thimbleware.jmemcached.LRUCacheStorageDelegate
All Implemented Interfaces:
CacheStorage

public final class LRUCacheStorageDelegate
extends java.lang.Object
implements CacheStorage

A delegate around the internal thread-safe LRUCache implementation.


Constructor Summary
LRUCacheStorageDelegate(int maxSize, long maxBytes, long ceilingSize)
           
 
Method Summary
 long count()
           
 void flushAll()
          Flush all entries from the cache
 MCElement get(java.lang.String keystring)
          Retrieve an element from the cache.
 java.util.Set<java.lang.String> keys()
           
 long maxSize()
           
 void put(java.lang.String keystring, MCElement el)
          Put an entry into the cache or replace an existing entry.
 void remove(java.lang.String keystring)
          Remove an entry from the cache
 long size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LRUCacheStorageDelegate

public LRUCacheStorageDelegate(int maxSize,
                               long maxBytes,
                               long ceilingSize)
Method Detail

get

public MCElement get(java.lang.String keystring)
Description copied from interface: CacheStorage
Retrieve an element from the cache. The retriever is responsible for counting hits, managing expirations, etc.

Specified by:
get in interface CacheStorage
Parameters:
keystring - the key identifying the entry
Returns:
a cache element

put

public void put(java.lang.String keystring,
                MCElement el)
Description copied from interface: CacheStorage
Put an entry into the cache or replace an existing entry.

Specified by:
put in interface CacheStorage
Parameters:
keystring - the key identifying the entry
el - the element to place in the cache

remove

public void remove(java.lang.String keystring)
Description copied from interface: CacheStorage
Remove an entry from the cache

Specified by:
remove in interface CacheStorage
Parameters:
keystring - the key to lookup

keys

public java.util.Set<java.lang.String> keys()
Specified by:
keys in interface CacheStorage
Returns:
the list of keys currently managed in the cache

size

public long size()
Specified by:
size in interface CacheStorage
Returns:
the total count (in bytes) of all the elements in the cache

flushAll

public void flushAll()
Description copied from interface: CacheStorage
Flush all entries from the cache

Specified by:
flushAll in interface CacheStorage

count

public long count()
Specified by:
count in interface CacheStorage
Returns:
how many entries are in the cache

maxSize

public long maxSize()
Specified by:
maxSize in interface CacheStorage
Returns:
the maximum capacity (in bytes) of the cache


Copyright © 2008. All Rights Reserved.