|
||||||||||
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 |
compareAndRemove(java.lang.Object key,
long version)
Removes the entry from the cache if the current entry matches the version. |
boolean |
compareVersionAndPut(java.lang.Object key,
long version,
java.lang.Object value)
Updates the cache if the old version matches the current 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()
|
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. |
ExtCacheEntry |
getLiveCacheEntry(java.lang.Object key)
|
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()
|
long |
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(long valueDataId)
|
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(long valueIndex,
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). |
ExtCacheEntry |
put(java.lang.Object key,
java.io.InputStream is,
long accessedExpireTimeout,
long modifiedExpireTimeout,
long lastAccessTime,
long lastModifiedTime)
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 |
putIfNew(java.lang.Object key,
MnodeUpdate update,
java.io.InputStream is)
Puts a new item in the cache with a custom idle timeout (used for sessions). |
boolean |
registerCacheEntryListener(CacheEntryListener listener)
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)
|
long |
saveData(StreamSource source,
int length)
|
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 |
setBacking(CacheBacking<?,?> backing)
|
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 |
setCacheReaderWriter(CacheLoader loader)
Sets the CacheLoader and CacheWriter which the Cache can then use to populate cache misses from a reference store (database). |
void |
setCacheWriter(CacheWriter writer)
Sets the CacheWrite that the Cache can then use to save cache misses from a reference store (database). |
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 |
setReadThrough(boolean isReadThrough)
|
void |
setScopeMode(ResinCacheBuilder.Scope scope)
|
void |
setSerializer(CacheSerializer serializer)
Assign the serializer used on values. |
void |
setWriteThrough(boolean isWriteThrough)
|
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 Cache
public void setCacheManager(CacheManagerFacade cacheManager)
@Configurable public void setCacheLoader(CacheLoader loader)
@Configurable public void setReadThrough(boolean isReadThrough)
@Configurable public void setCacheWriter(CacheWriter writer)
@Configurable public void setWriteThrough(boolean isWriteThrough)
@Configurable public void setCacheReaderWriter(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 setBacking(CacheBacking<?,?> backing)
backing
- 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 Cache
public boolean get(java.lang.Object key, java.io.OutputStream os) throws java.io.IOException
get
in interface ByteStreamCache
java.io.IOException
public ExtCacheEntry getExtCacheEntry(java.lang.Object key)
getExtCacheEntry
in interface ByteStreamCache
getExtCacheEntry
in interface ObjectCache
public ExtCacheEntry getExtCacheEntry(HashKey key)
public ExtCacheEntry peekExtCacheEntry(java.lang.Object key)
peekExtCacheEntry
in interface ByteStreamCache
public ExtCacheEntry getStatCacheEntry(java.lang.Object key)
getStatCacheEntry
in interface ObjectCache
public Cache.Entry getCacheEntry(java.lang.Object key)
public ExtCacheEntry getLiveCacheEntry(java.lang.Object key)
public void put(java.lang.Object key, java.lang.Object value)
put
in interface Cache
key
- the key of the item to putvalue
- the value of the item to putpublic boolean putIfAbsent(java.lang.Object key, java.lang.Object value) throws CacheException
putIfAbsent
in interface Cache
CacheException
public boolean replace(java.lang.Object key, java.lang.Object oldValue, java.lang.Object value) throws CacheException
replace
in interface Cache
CacheException
public boolean replace(java.lang.Object key, java.lang.Object value) throws CacheException
replace
in interface Cache
CacheException
public java.lang.Object getAndReplace(java.lang.Object key, java.lang.Object value) throws CacheException
getAndReplace
in interface Cache
CacheException
public boolean remove(java.lang.Object key)
remove
in interface ByteStreamCache
remove
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 Cache
CacheException
public boolean compareAndRemove(java.lang.Object key, long version)
compareAndRemove
in interface ByteStreamCache
compareAndRemove
in interface ObjectCache
public java.util.concurrent.Future load(java.lang.Object key) throws CacheException
load
in interface Cache
CacheException
public java.util.concurrent.Future loadAll(java.util.Set keys) throws CacheException
loadAll
in interface Cache
CacheException
public void removeAll() throws CacheException
removeAll
in interface Cache
CacheException
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface Cache
public Status getStatus()
getStatus
in interface CacheLifecycle
public void start() throws CacheException
start
in interface CacheLifecycle
CacheException
public void stop() throws CacheException
stop
in interface CacheLifecycle
CacheException
public 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 ByteStreamCache
key
- 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 ByteStreamCache
key
- the key of the item to putis
- the value of the item to putidleTimeout
- the idle timeout for the item
java.io.IOException
public ExtCacheEntry put(java.lang.Object key, java.io.InputStream is, long accessedExpireTimeout, long modifiedExpireTimeout, long lastAccessTime, long lastModifiedTime) throws java.io.IOException
put
in interface ByteStreamCache
key
- the key of the item to putis
- the value of the item to putidleTimeout
- the idle timeout for the item
java.io.IOException
public boolean putIfNew(java.lang.Object key, MnodeUpdate update, java.io.InputStream is) throws java.io.IOException
putIfNew
in interface ByteStreamCache
key
- 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 Cache
key
- the key of the item to putvalue
- the value of the item to putpublic boolean compareVersionAndPut(java.lang.Object key, long version, java.lang.Object value)
compareVersionAndPut
in interface ObjectCache
key
- the key to compareversion
- the version of the old value, returned by getEntryvalue
- the new value
public java.util.Map getAll(java.util.Collection keys)
public boolean registerCacheEntryListener(CacheEntryListener listener)
registerCacheEntryListener
in interface Cache
public boolean unregisterCacheEntryListener(CacheEntryListener listener)
unregisterCacheEntryListener
in interface Cache
public CacheStatistics getStatistics()
getStatistics
in interface Cache
public void putAll(java.util.Map map)
putAll
in interface Cache
public boolean containsKey(java.lang.Object key)
containsKey
in interface Cache
key
-
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 ObjectCache
public void close()
close
in interface java.io.Closeable
public boolean loadData(long valueIndex, WriteStream os) throws java.io.IOException
java.io.IOException
public long saveData(StreamSource source, int length) throws java.io.IOException
java.io.IOException
public boolean isDataAvailable(long valueDataId)
public byte[] getKeyHash(java.lang.String name)
public long getValueHash(java.lang.Object value)
public MnodeStore getMnodeStore()
public DataStore getDataStore()
public CacheImpl createIfAbsent()
@PostConstruct public void init()
public CacheConfiguration getConfiguration()
getConfiguration
in interface Cache
public 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 Cache
public void removeAll(java.util.Set keys)
removeAll
in interface Cache
public CacheMXBean getMBean()
getMBean
in interface Cache
public 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 |