|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.distcache.AbstractCache
public class AbstractCache
Implements the distributed cache
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface javax.cache.Cache |
|---|
Cache.Entry<K,V>, Cache.EntryProcessor<K,V>, Cache.MutableEntry<K,V> |
| Nested classes/interfaces inherited from interface com.caucho.distcache.ResinCacheBuilder |
|---|
ResinCacheBuilder.Persistence, ResinCacheBuilder.Scope |
| Constructor Summary | |
|---|---|
AbstractCache()
|
|
| 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()
|
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. |
long |
getAccessedExpireTimeout()
The maximum idle time for an item, which is typically used for temporary data like sessions. |
long |
getAccessedExpireTimeoutWindow()
Returns the idle check window, used to minimize traffic when updating access times. |
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()
|
CacheManagerFacade |
getCacheManager()
|
CacheConfig |
getConfig()
|
CacheConfiguration |
getConfiguration()
|
DataStore |
getDataStore()
|
java.lang.Object |
getExact(java.lang.Object key)
Returns the object with the given key, checking the backing store if necessary. |
ExtCacheEntry |
getExtCacheEntry(HashKey key)
|
ExtCacheEntry |
getExtCacheEntry(java.lang.Object key)
Returns the cache entry for the object with the given key. |
HashKey |
getKeyHash(java.lang.Object key)
Returns the hash of the given key |
byte[] |
getKeyHash(java.lang.String name)
|
long |
getLeaseExpireTimeout()
The lease timeout is the time a server can use the local version if it owns it, before a timeout. |
long |
getLocalExpireTimeout()
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()
|
long |
getModifiedExpireTimeout()
The maximum valid time for an item. |
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)
|
void |
init()
Initialize the cache. |
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 userFlags)
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)
|
void |
saveData(java.lang.Object value)
|
void |
setAccessedExpireTimeout(Period period)
The maximum idle time for an item, which is typically used for temporary data like sessions. |
void |
setAccessedExpireTimeoutMillis(long timeout)
Sets the idle timeout in milliseconds |
void |
setAccessedExpireTimeoutWindow(Period period)
Sets the idle timeout windows |
void |
setCacheLoader(CacheLoader loader)
Sets the CacheLoader that the Cache can then use to populate cache misses from a reference store (database). |
void |
setCacheManager(CacheManagerFacade cacheManager)
|
void |
setEngine(CacheEngine engine)
|
void |
setExpireTimeout(Period expireTimeout)
Backwards compat. |
void |
setIdleTimeout(Period period)
|
void |
setLeaseExpireTimeout(Period period)
The lease timeout is the time a server can use the local version if it owns it, before a timeout. |
void |
setLeaseExpireTimeoutMillis(long timeout)
The lease timeout is the time a server can use the local version if it owns it, before a timeout. |
void |
setLeaseTimeout(Period period)
|
void |
setLocalExpireTimeout(Period period)
The local read timeout sets how long a local copy of a cache item can be reused before checking with the master copy. |
void |
setLocalExpireTimeoutMillis(long period)
The local read timeout sets how long a local copy of a cache item can be reused before checking with the master copy. |
void |
setLocalReadTimeout(Period period)
Backwards compat. |
void |
setManagerName(java.lang.String managerName)
|
void |
setModifiedExpireTimeout(Period expireTimeout)
The maximum valid time for a cached item before it expires. |
void |
setModifiedExpireTimeoutMillis(long expireTimeout)
The maximum valid time for an item. |
void |
setName(java.lang.String name)
Assigns the name of the cache. |
void |
setPersistenceMode(ResinCacheBuilder.Persistence persistence)
|
void |
setScopeMode(ResinCacheBuilder.Scope scope)
|
void |
setSerializer(CacheSerializer serializer)
Assign the serializer used on values. |
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 AbstractCache()
| Method Detail |
|---|
public java.lang.String getName()
getName in interface Cache@Configurable public void setName(java.lang.String name)
@Configurable public void setManagerName(java.lang.String managerName)
public CacheManagerFacade getCacheManager()
getCacheManager in interface Cachepublic void setCacheManager(CacheManagerFacade cacheManager)
@Configurable public void setCacheLoader(CacheLoader loader)
@Configurable public void setSerializer(CacheSerializer serializer)
public void setEngine(CacheEngine engine)
@Configurable public void setAccessedExpireTimeout(Period period)
@Configurable public void setIdleTimeout(Period period)
public long getAccessedExpireTimeout()
@Configurable public void setAccessedExpireTimeoutMillis(long timeout)
public long getAccessedExpireTimeoutWindow()
public void setAccessedExpireTimeoutWindow(Period period)
public long getModifiedExpireTimeout()
@Configurable public void setModifiedExpireTimeout(Period expireTimeout)
@Configurable public void setExpireTimeout(Period expireTimeout)
@Configurable public void setModifiedExpireTimeoutMillis(long expireTimeout)
public long getLeaseExpireTimeout()
@Configurable public void setLeaseExpireTimeout(Period period)
@Configurable public void setLeaseTimeout(Period period)
@Configurable public void setLeaseExpireTimeoutMillis(long timeout)
public long getLocalExpireTimeout()
@Configurable public void setLocalExpireTimeout(Period period)
@Configurable public void setLocalReadTimeout(Period period)
@Configurable public void setLocalExpireTimeoutMillis(long period)
public void setScopeMode(ResinCacheBuilder.Scope scope)
public boolean isBackup()
public boolean isTriplicate()
public void setPersistenceMode(ResinCacheBuilder.Persistence persistence)
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 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 ObjectCache
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 Cache
public ExtCacheEntry put(java.lang.Object key,
java.io.InputStream is,
long accessedExpireTimeout,
long modifiedExpireTimeout,
int userFlags)
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.IOExceptionpublic 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 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 CacheImpl createIfAbsent()
@PostConstruct public void init()
public CacheConfiguration getConfiguration()
getConfiguration in interface Cachepublic CacheConfig getConfig()
public 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 Cachepublic CacheMXBean getMBean()
getMBean in interface Cachepublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||