com.thimbleware.jmemcached
Interface Cache<CACHE_ELEMENT extends CacheElement>

All Known Implementing Classes:
AbstractCache, CacheImpl

public interface Cache<CACHE_ELEMENT extends CacheElement>


Nested Class Summary
static class Cache.DeleteResponse
          Enum defining responses statuses from removal commands
static class Cache.StoreResponse
          Enum defining response statuses from set/add type commands
 
Method Summary
 Cache.StoreResponse add(CACHE_ELEMENT e)
          Add an element to the cache
 Cache.StoreResponse append(CACHE_ELEMENT element)
          Append bytes to the end of an element in the cache
 void asyncEventPing()
          Called periodically by the network event loop to process any pending events.
 Cache.StoreResponse cas(java.lang.Long cas_key, CACHE_ELEMENT e)
          Set an element in the cache but only if the element has not been touched since the last 'gets'
 void close()
          Close the cache, freeing all resources on which it depends.
 Cache.DeleteResponse delete(Key key, int time)
          Handle the deletion of an item from the cache.
 boolean flush_all()
          Flush all cache entries
 boolean flush_all(int expire)
          Flush all cache entries with a timestamp after a given expiration time
 java.lang.Integer get_add(Key key, int mod)
          Increment/decremen t an (integer) element in the cache
 CACHE_ELEMENT[] get(Key... keys)
          Get element(s) from the cache
 long getCurrentBytes()
           
 long getCurrentItems()
           
 int getGetCmds()
           
 int getGetHits()
           
 int getGetMisses()
           
 long getLimitMaxBytes()
           
 int getSetCmds()
           
 Cache.StoreResponse prepend(CACHE_ELEMENT element)
          Prepend bytes to the end of an element in the cache
 Cache.StoreResponse replace(CACHE_ELEMENT e)
          Replace an element in the cache
 Cache.StoreResponse set(CACHE_ELEMENT e)
          Set an element in the cache
 java.util.Map<java.lang.String,java.util.Set<java.lang.String>> stat(java.lang.String arg)
          Retrieve stats about the cache.
 

Method Detail

delete

Cache.DeleteResponse delete(Key key,
                            int time)
Handle the deletion of an item from the cache.

Parameters:
key - the key for the item
time - an amount of time to block this entry in the cache for further writes
Returns:
the message response

add

Cache.StoreResponse add(CACHE_ELEMENT e)
Add an element to the cache

Parameters:
e - the element to add
Returns:
the store response code

replace

Cache.StoreResponse replace(CACHE_ELEMENT e)
Replace an element in the cache

Parameters:
e - the element to replace
Returns:
the store response code

append

Cache.StoreResponse append(CACHE_ELEMENT element)
Append bytes to the end of an element in the cache

Parameters:
element - the element to append
Returns:
the store response code

prepend

Cache.StoreResponse prepend(CACHE_ELEMENT element)
Prepend bytes to the end of an element in the cache

Parameters:
element - the element to append
Returns:
the store response code

set

Cache.StoreResponse set(CACHE_ELEMENT e)
Set an element in the cache

Parameters:
e - the element to set
Returns:
the store response code

cas

Cache.StoreResponse cas(java.lang.Long cas_key,
                        CACHE_ELEMENT e)
Set an element in the cache but only if the element has not been touched since the last 'gets'

Parameters:
cas_key - the cas key returned by the last gets
e - the element to set
Returns:
the store response code

get_add

java.lang.Integer get_add(Key key,
                          int mod)
Increment/decremen t an (integer) element in the cache

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

get

CACHE_ELEMENT[] get(Key... keys)
Get element(s) from the cache

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

flush_all

boolean flush_all()
Flush all cache entries

Returns:
command response

flush_all

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

close

void close()
           throws java.io.IOException
Close the cache, freeing all resources on which it depends.

Throws:
java.io.IOException

getCurrentItems

long getCurrentItems()
Returns:
the # of items in the cache

getLimitMaxBytes

long getLimitMaxBytes()
Returns:
the maximum size of the cache (in bytes)

getCurrentBytes

long getCurrentBytes()
Returns:
the current cache usage (in bytes)

getGetCmds

int getGetCmds()
Returns:
the number of get commands executed

getSetCmds

int getSetCmds()
Returns:
the number of set commands executed

getGetHits

int getGetHits()
Returns:
the number of get hits

getGetMisses

int getGetMisses()
Returns:
the number of stats

stat

java.util.Map<java.lang.String,java.util.Set<java.lang.String>> stat(java.lang.String arg)
Retrieve stats about the cache. If an argument is specified, a specific category of stats is requested.

Parameters:
arg - a specific extended stat sub-category
Returns:
a map of stats

asyncEventPing

void asyncEventPing()
Called periodically by the network event loop to process any pending events. (such as delete queues, etc.)



Copyright © 2008-2011 ThimbleWare. All Rights Reserved.