com.thimbleware.jmemcached
Class AbstractCache<CACHE_ELEMENT extends CacheElement>
java.lang.Object
com.thimbleware.jmemcached.AbstractCache<CACHE_ELEMENT>
- All Implemented Interfaces:
- Cache<CACHE_ELEMENT>
- Direct Known Subclasses:
- CacheImpl
public abstract class AbstractCache<CACHE_ELEMENT extends CacheElement>
- extends java.lang.Object
- implements Cache<CACHE_ELEMENT>
Abstract implementation of a cache handler for the memcache daemon; provides some convenience methods and
a general framework for implementation
|
Field Summary |
protected java.util.concurrent.atomic.AtomicLong |
casCounter
|
protected java.util.concurrent.atomic.AtomicInteger |
getCmds
|
protected java.util.concurrent.atomic.AtomicInteger |
getHits
|
protected java.util.concurrent.atomic.AtomicInteger |
getMisses
|
protected java.util.concurrent.atomic.AtomicInteger |
setCmds
|
protected java.util.concurrent.atomic.AtomicLong |
started
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.thimbleware.jmemcached.Cache |
add, append, cas, close, delete, flush_all, flush_all, get_add, get, prepend, replace, set |
started
protected final java.util.concurrent.atomic.AtomicLong started
getCmds
protected final java.util.concurrent.atomic.AtomicInteger getCmds
setCmds
protected final java.util.concurrent.atomic.AtomicInteger setCmds
getHits
protected final java.util.concurrent.atomic.AtomicInteger getHits
getMisses
protected final java.util.concurrent.atomic.AtomicInteger getMisses
casCounter
protected final java.util.concurrent.atomic.AtomicLong casCounter
AbstractCache
public AbstractCache()
Now
public static int Now()
- Returns:
- the current time in seconds (from epoch), used for expiries, etc.
keys
protected abstract java.util.Set<Key> keys()
getCurrentItems
public abstract long getCurrentItems()
- Specified by:
getCurrentItems in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the # of items in the cache
getLimitMaxBytes
public abstract long getLimitMaxBytes()
- Specified by:
getLimitMaxBytes in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the maximum size of the cache (in bytes)
getCurrentBytes
public abstract long getCurrentBytes()
- Specified by:
getCurrentBytes in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the current cache usage (in bytes)
getGetCmds
public final int getGetCmds()
- Specified by:
getGetCmds in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the number of get commands executed
getSetCmds
public final int getSetCmds()
- Specified by:
getSetCmds in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the number of set commands executed
getGetHits
public final int getGetHits()
- Specified by:
getGetHits in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the number of get hits
getGetMisses
public final int getGetMisses()
- Specified by:
getGetMisses in interface Cache<CACHE_ELEMENT extends CacheElement>
- Returns:
- the number of stats
stat
public final java.util.Map<java.lang.String,java.util.Set<java.lang.String>> stat(java.lang.String arg)
- Return runtime statistics
- Specified by:
stat in interface Cache<CACHE_ELEMENT extends CacheElement>
- Parameters:
arg - additional arguments to the stats command
- Returns:
- the full command response
initStats
protected void initStats()
- Initialize all statistic counters
asyncEventPing
public abstract void asyncEventPing()
- Description copied from interface:
Cache
- Called periodically by the network event loop to process any pending events.
(such as delete queues, etc.)
- Specified by:
asyncEventPing in interface Cache<CACHE_ELEMENT extends CacheElement>
Copyright © 2008-2011 ThimbleWare. All Rights Reserved.