|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.distcache.CacheImpl
public class CacheImpl
Implements the distributed cache
| Nested Class Summary | |
|---|---|
protected static class |
CacheImpl.CacheEntrySetIterator<K,V>
Provides an iterator over the entries in the the local cache. |
| Nested classes/interfaces inherited from interface javax.cache.Cache |
|---|
Cache.Entry<K,V>, Cache.EntryProcessor<K,V>, Cache.MutableEntry<K,V> |
| Constructor Summary | |
|---|---|
CacheImpl(CacheManagerImpl localManager,
java.lang.String name,
java.lang.String guid,
CacheConfig config)
|
|
| Method Summary | |
|---|---|
protected java.lang.Object |
cacheLoader(java.lang.Object key)
Places an item in the cache from the loader unless the item is in cache already. |
void |
close()
|
void |
compareAndPut(HashKey key,
HashKey value,
long valueLength,
long version)
|
boolean |
compareAndPut(java.lang.Object key,
long version,
java.io.InputStream inputStream)
Updates the cache if the old version matches the current value. |
boolean |
compareAndPut(java.lang.Object key,
long version,
java.lang.Object value)
Updates the cache if the old version matches the current version. |
boolean |
compareAndRemove(java.lang.Object key,
long version)
Removes the entry from the cache if the current entry matches the version. |
boolean |
containsKey(java.lang.Object key)
Returns true if an entry for the item is found in the cache. |
CacheImpl |
createIfAbsent()
|
java.lang.Object |
get(java.lang.Object key)
Returns the object with the given key, checking the backing store if necessary. |
boolean |
get(java.lang.Object key,
java.io.OutputStream os)
Fills an output stream with the value for a key. |
java.util.Map |
getAll(java.util.Collection keys)
Returns a new map of the items found in the central cache. |
java.util.Map |
getAll(java.util.Set keys)
|
java.lang.Object |
getAndPut(java.lang.Object key,
java.lang.Object value)
Puts a new item in the cache. |
java.lang.Object |
getAndRemove(java.lang.Object key)
|
java.lang.Object |
getAndReplace(java.lang.Object key,
java.lang.Object value)
|
Cache.Entry |
getCacheEntry(java.lang.Object key)
Returns the cache entry for the object with the given key. |
HashKey |
getCacheKey()
|
CacheManager |
getCacheManager()
|
CacheConfiguration |
getConfiguration()
|
DataStore |
getDataStore()
|
protected DistCacheEntry |
getDistCacheEntry(HashKey key)
Returns the CacheKeyEntry for the given key. |
protected DistCacheEntry |
getDistCacheEntry(java.lang.Object key)
Returns the CacheKeyEntry for the given key. |
java.lang.Object |
getExact(java.lang.Object key)
Returns the object with the given key always checking the backing store . |
long |
getExpireTimeout()
The maximum valid time for an item. |
ExtCacheEntry |
getExtCacheEntry(HashKey key)
|
ExtCacheEntry |
getExtCacheEntry(java.lang.Object key)
Returns the cache entry for the object with the given key. |
java.lang.String |
getGuid()
|
long |
getIdleTimeout()
The maximum idle time for an item, which is typically used for temporary data like sessions. |
long |
getIdleTimeoutWindow()
Returns the idle check window, used to minimize traffic when updating access times. |
HashKey |
getKeyHash(java.lang.Object key)
Returns the hash of the given key |
byte[] |
getKeyHash(java.lang.String name)
|
long |
getLeaseTimeout()
The lease timeout is the time a server can use the local version if it owns it, before a timeout. |
ExtCacheEntry |
getLiveCacheEntry(java.lang.Object key)
Returns the entry for the given key, returning the live item. |
long |
getLocalReadTimeout()
The local read timeout is how long a local copy of a cache item can be reused before checking with the master copy. |
CacheMXBean |
getMBean()
|
MnodeStore |
getMnodeStore()
|
java.lang.String |
getName()
Returns the name of the cache. |
ExtCacheEntry |
getStatCacheEntry(java.lang.Object key)
|
CacheStatistics |
getStatistics()
Returns the CacheStatistics for this cache. |
Status |
getStatus()
|
byte[] |
getValueHash(java.lang.Object value)
|
java.lang.Object |
invokeEntryProcessor(java.lang.Object key,
Cache.EntryProcessor entryProcessor)
|
boolean |
isBackup()
|
boolean |
isClosed()
Returns true if the cache is closed |
boolean |
isDataAvailable(HashKey valueKey)
|
boolean |
isTriplicate()
|
java.util.Iterator |
iterator()
|
java.util.concurrent.Future |
load(java.lang.Object key)
|
java.util.concurrent.Future |
loadAll(java.util.Set keys)
|
boolean |
loadData(HashKey valueHash,
WriteStream os)
|
protected void |
notifyClear(java.lang.Object key)
|
protected void |
notifyEvict(java.lang.Object key)
|
protected void |
notifyLoad(java.lang.Object key)
|
protected void |
notifyPut(java.lang.Object key)
|
protected void |
notifyRemove(java.lang.Object key)
|
java.lang.Object |
peek(java.lang.Object key)
Returns the object with the given key without checking the backing store. |
ExtCacheEntry |
peekExtCacheEntry(java.lang.Object key)
Returns the cache entry for the object with the given key. |
ExtCacheEntry |
put(java.lang.Object key,
java.io.InputStream is,
long accessedExpireTimeout,
long modifiedExpireTimeout)
Puts a new item in the cache with a custom idle timeout (used for sessions). |
ExtCacheEntry |
put(java.lang.Object key,
java.io.InputStream is,
long accessedExpireTimeout,
long modifiedExpireTimeout,
int flags)
Puts a new item in the cache with a custom idle timeout (used for sessions). |
void |
put(java.lang.Object key,
java.lang.Object value)
Puts a new item in the cache. |
void |
putAll(java.util.Map map)
Puts each item in the map into the cache. |
boolean |
putIfAbsent(java.lang.Object key,
java.lang.Object value)
|
boolean |
registerCacheEntryListener(CacheEntryListener listener,
Filter filter)
Adds a listener to the cache. |
boolean |
remove(java.lang.Object key)
Removes the entry from the cache. |
boolean |
remove(java.lang.Object key,
java.lang.Object oldValue)
Removes the entry from the cache. |
void |
removeAll()
|
void |
removeAll(java.util.Set keys)
|
boolean |
replace(java.lang.Object key,
java.lang.Object value)
|
boolean |
replace(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object value)
|
boolean |
saveData(HashKey valueHash,
StreamSource source,
int length)
|
HashKey |
saveData(java.io.InputStream is)
|
void |
saveData(java.lang.Object value)
|
void |
setManager(CacheStoreManager manager)
|
void |
start()
|
void |
stop()
|
java.lang.String |
toString()
|
boolean |
unregisterCacheEntryListener(CacheEntryListener listener)
Removes a listener from the cache. |
java.lang.Object |
unwrap(java.lang.Class cl)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CacheImpl(CacheManagerImpl localManager,
java.lang.String name,
java.lang.String guid,
CacheConfig config)
| Method Detail |
|---|
public java.lang.String getName()
getName in interface Cachepublic CacheManager getCacheManager()
getCacheManager in interface Cachepublic java.lang.String getGuid()
public long getExpireTimeout()
public long getIdleTimeout()
public long getIdleTimeoutWindow()
public long getLeaseTimeout()
public long getLocalReadTimeout()
public CacheImpl createIfAbsent()
public java.lang.Object peek(java.lang.Object key)
public HashKey getKeyHash(java.lang.Object key)
public java.lang.Object get(java.lang.Object key)
get in interface Cachepublic java.lang.Object getExact(java.lang.Object key)
getExact in interface ObjectCache
public boolean get(java.lang.Object key,
java.io.OutputStream os)
throws java.io.IOException
get in interface ByteStreamCachejava.io.IOExceptionpublic ExtCacheEntry getExtCacheEntry(java.lang.Object key)
getExtCacheEntry in interface ByteStreamCachegetExtCacheEntry in interface ObjectCachepublic ExtCacheEntry getExtCacheEntry(HashKey key)
public ExtCacheEntry peekExtCacheEntry(java.lang.Object key)
peekExtCacheEntry in interface ByteStreamCachepublic ExtCacheEntry getStatCacheEntry(java.lang.Object key)
getStatCacheEntry in interface ObjectCachepublic Cache.Entry getCacheEntry(java.lang.Object key)
public void put(java.lang.Object key,
java.lang.Object value)
put in interface Cachekey - the key of the item to putvalue - the value of the item to put
public ExtCacheEntry put(java.lang.Object key,
java.io.InputStream is,
long accessedExpireTimeout,
long modifiedExpireTimeout,
int flags)
throws java.io.IOException
put in interface ByteStreamCachekey - the key of the item to putis - the value of the item to putidleTimeout - the idle timeout for the itemflags - the flags value (for memcache)
java.io.IOException
public ExtCacheEntry put(java.lang.Object key,
java.io.InputStream is,
long accessedExpireTimeout,
long modifiedExpireTimeout)
throws java.io.IOException
put in interface ByteStreamCachekey - the key of the item to putis - the value of the item to putidleTimeout - the idle timeout for the item
java.io.IOException
public java.lang.Object getAndPut(java.lang.Object key,
java.lang.Object value)
getAndPut in interface Cachekey - the key of the item to putvalue - the value of the item to put
public boolean compareAndPut(java.lang.Object key,
long version,
java.lang.Object value)
compareAndPut in interface ObjectCachekey - the key to compareversion - the version of the old value, returned by getEntryvalue - the new value
public boolean compareAndPut(java.lang.Object key,
long version,
java.io.InputStream inputStream)
throws java.io.IOException
compareAndPut in interface ByteStreamCachekey - the key to compareversion - the hash of the old version, returned by getEntryinputStream - the new value
java.io.IOException
public void compareAndPut(HashKey key,
HashKey value,
long valueLength,
long version)
public boolean putIfAbsent(java.lang.Object key,
java.lang.Object value)
throws CacheException
putIfAbsent in interface CacheCacheException
public boolean replace(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object value)
throws CacheException
replace in interface CacheCacheException
public boolean replace(java.lang.Object key,
java.lang.Object value)
throws CacheException
replace in interface CacheCacheException
public java.lang.Object getAndReplace(java.lang.Object key,
java.lang.Object value)
throws CacheException
getAndReplace in interface CacheCacheExceptionpublic boolean remove(java.lang.Object key)
remove in interface ByteStreamCacheremove in interface Cache
public boolean remove(java.lang.Object key,
java.lang.Object oldValue)
remove in interface Cache
public java.lang.Object getAndRemove(java.lang.Object key)
throws CacheException
getAndRemove in interface CacheCacheException
public boolean compareAndRemove(java.lang.Object key,
long version)
compareAndRemove in interface ByteStreamCachecompareAndRemove in interface ObjectCachepublic ExtCacheEntry getLiveCacheEntry(java.lang.Object key)
protected DistCacheEntry getDistCacheEntry(java.lang.Object key)
protected DistCacheEntry getDistCacheEntry(HashKey key)
public java.util.Map getAll(java.util.Collection keys)
public boolean registerCacheEntryListener(CacheEntryListener listener,
Filter filter)
registerCacheEntryListener in interface Cachepublic boolean unregisterCacheEntryListener(CacheEntryListener listener)
unregisterCacheEntryListener in interface Cachepublic CacheStatistics getStatistics()
getStatistics in interface Cachepublic void putAll(java.util.Map map)
putAll in interface Cachepublic boolean containsKey(java.lang.Object key)
containsKey in interface Cachekey -
public boolean isBackup()
public boolean isTriplicate()
public HashKey getCacheKey()
protected java.lang.Object cacheLoader(java.lang.Object key)
protected void notifyLoad(java.lang.Object key)
protected void notifyEvict(java.lang.Object key)
protected void notifyClear(java.lang.Object key)
protected void notifyPut(java.lang.Object key)
protected void notifyRemove(java.lang.Object key)
public boolean isClosed()
ObjectCache
isClosed in interface ObjectCachepublic void close()
close in interface java.io.Closeable
public boolean loadData(HashKey valueHash,
WriteStream os)
throws java.io.IOException
java.io.IOException
public boolean saveData(HashKey valueHash,
StreamSource source,
int length)
throws java.io.IOException
java.io.IOExceptionpublic boolean isDataAvailable(HashKey valueKey)
public byte[] getKeyHash(java.lang.String name)
public byte[] getValueHash(java.lang.Object value)
public MnodeStore getMnodeStore()
public DataStore getDataStore()
public void saveData(java.lang.Object value)
public HashKey saveData(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic void setManager(CacheStoreManager manager)
public CacheMXBean getMBean()
getMBean in interface Cachepublic java.lang.String toString()
toString in class java.lang.Objectpublic CacheConfiguration getConfiguration()
getConfiguration in interface Cache
public java.util.concurrent.Future load(java.lang.Object key)
throws CacheException
load in interface CacheCacheException
public java.util.concurrent.Future loadAll(java.util.Set keys)
throws CacheException
loadAll in interface CacheCacheException
public void removeAll()
throws CacheException
removeAll in interface CacheCacheExceptionpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface Cachepublic Status getStatus()
getStatus in interface CacheLifecycle
public void start()
throws CacheException
start in interface CacheLifecycleCacheException
public void stop()
throws CacheException
stop in interface CacheLifecycleCacheExceptionpublic java.lang.Object unwrap(java.lang.Class cl)
unwrap in interface Cachepublic java.util.Map getAll(java.util.Set keys)
getAll in interface Cache
public java.lang.Object invokeEntryProcessor(java.lang.Object key,
Cache.EntryProcessor entryProcessor)
invokeEntryProcessor in interface Cachepublic void removeAll(java.util.Set keys)
removeAll in interface Cache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||