com.thimbleware.jmemcached
Class Cache

java.lang.Object
  extended by com.thimbleware.jmemcached.Cache

public class Cache
extends java.lang.Object


Field Summary
protected  CacheStorage cacheStorage
           
 int currentItems
           
 int getCmds
           
 int getHits
           
 int getMisses
           
 int setCmds
           
 int totalItems
           
 
Constructor Summary
Cache(CacheStorage cacheStorage)
          Construct the server session handler
 
Method Summary
protected  boolean add(MCElement e)
          Add an element to the cache
 boolean delete(java.lang.String key, int time)
          Handle the deletion of an item from the cache.
protected  boolean flush_all()
          Flush all cache entries
protected  boolean flush_all(int expire)
          Flush all cache entries with a timestamp after a given expiration time
protected  java.lang.Integer get_add(java.lang.String key, int mod)
          Increment an (integer) element inthe cache
protected  MCElement get(java.lang.String key)
          Get an element from the cache
 long getCurrentBytes()
           
 long getCurrentItems()
           
 int getGetCmds()
           
 int getGetHits()
           
 int getGetMisses()
           
 long getLimitMaxBytes()
           
 int getSetCmds()
           
 int getTotalItems()
           
protected  void initStats()
          Initialize all statistic counters
protected  boolean is_there(java.lang.String key)
          Check whether an element is in the cache and non-expired
 java.util.Set<java.lang.String> keys()
           
protected  int Now()
           
 boolean replace(MCElement e)
          Replace an element in the cache
protected  boolean set(MCElement e)
          Set an element in the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentItems

public int currentItems

totalItems

public int totalItems

getCmds

public int getCmds

setCmds

public int setCmds

getHits

public int getHits

getMisses

public int getMisses

cacheStorage

protected CacheStorage cacheStorage
Constructor Detail

Cache

public Cache(CacheStorage cacheStorage)
Construct the server session handler

Parameters:
cacheStorage - the cache to use
Method Detail

delete

public boolean delete(java.lang.String key,
                      int time)
Handle the deletion of an item from the cache.

Parameters:
key - the key for the item
time - only delete the element if time (time in seconds)
Returns:
the message response

add

protected boolean add(MCElement e)
Add an element to the cache

Parameters:
e - the element to add
Returns:
the message response string

replace

public boolean replace(MCElement e)
Replace an element in the cache

Parameters:
e - the element to replace
Returns:
the message response string

set

protected boolean set(MCElement e)
Set an element in the cache

Parameters:
e - the element to set
Returns:
the message response string

get_add

protected java.lang.Integer get_add(java.lang.String key,
                                    int mod)
Increment an (integer) element inthe cache

Parameters:
key - the key to increment
mod - the amount to add to the value
Returns:
the message response

is_there

protected boolean is_there(java.lang.String key)
Check whether an element is in the cache and non-expired

Parameters:
key - the key for the element to lookup
Returns:
whether the element is in the cache and is live

get

protected MCElement get(java.lang.String key)
Get an element from the cache

Parameters:
key - the key for the element to lookup
Returns:
the element, or 'null' in case of cache miss.

flush_all

protected boolean flush_all()
Flush all cache entries

Returns:
command response

flush_all

protected boolean flush_all(int expire)
Flush all cache entries with a timestamp after a given expiration time

Parameters:
expire - the flush time in seconds
Returns:
command response

Now

protected final int Now()
Returns:
the current time in seconds (from epoch), used for expiries, etc.

initStats

protected void initStats()
Initialize all statistic counters


keys

public java.util.Set<java.lang.String> keys()

getCurrentItems

public long getCurrentItems()

getLimitMaxBytes

public long getLimitMaxBytes()

getCurrentBytes

public long getCurrentBytes()

getTotalItems

public int getTotalItems()

getGetCmds

public int getGetCmds()

getSetCmds

public int getSetCmds()

getGetHits

public int getGetHits()

getGetMisses

public int getGetMisses()


Copyright © 2008. All Rights Reserved.