com.caucho.server.distcache
Class DistCacheEntry

java.lang.Object
  extended by com.caucho.server.distcache.DistCacheEntry

public class DistCacheEntry
extends java.lang.Object

An entry in the cache map


Method Summary
 void clear()
          Invalidates the entry
 void clearLease()
           
 void clearLease(int oldLeaseOwner)
           
protected  boolean compareAndPut(DistCacheEntry entry, long testValue, MnodeUpdate mnodeUpdate, long valueDataId, java.lang.Object value, CacheConfig config)
           
 boolean compareAndPut(long testValue, java.lang.Object value)
           
 boolean compareAndPutLocal(long testValueHash, MnodeUpdate update, long valueDataId, java.lang.Object value)
           
 boolean compareAndPutLocal(long testValue, MnodeUpdate update, StreamSource source)
           
 boolean compareAndSetEntry(MnodeEntry oldMnodeValue, MnodeEntry mnodeValue)
          Sets the current value.
 java.lang.Object get()
          Returns the object for the given key, checking the backing if necessary.
 java.lang.Object getAndPut(java.lang.Object value)
          Sets the current value
protected  java.lang.Object getAndPut(java.lang.Object value, long now, MnodeEntry mnodeValue)
          Sets a cache entry
 long getAndPutLocal(DistCacheEntry entry, MnodeUpdate mnodeUpdate, long valueDataId, java.lang.Object value)
           
 long getAndPutLocal(MnodeUpdate mnodeUpdate, StreamSource source)
           
 java.lang.Object getAndRemove()
          Remove the value
 java.lang.Object getAndReplace(long testValue, java.lang.Object value)
           
 CacheHandle getCache()
           
 HashKey getCacheKey()
           
 byte[] getCacheKeyHash()
           
 CacheConfig getConfig()
           
 long getCost()
           
 CacheEngine getEngine()
           
 java.lang.Object getKey()
          Returns the key for this entry in the Cache.
 HashKey getKeyHash()
          Returns the keyHash
 int getLoadCount()
           
 boolean getLocalStream(java.io.OutputStream os)
          Gets a cache entry as a stream
 MnodeEntry getMnodeEntry()
          Returns the value section of the entry.
 TriadOwner getOwner()
          Returns the owner
 boolean getStream(java.io.OutputStream os)
          Gets a cache entry as a stream
 java.lang.Object getValue()
           
 long getValueHash()
           
 long getValueHash(java.lang.Object value, CacheConfig config)
           
 StreamSource getValueStream()
          Gets a cache entry as a stream
 long getVersion()
           
 boolean isLeaseExpired()
           
 boolean isModified(MnodeValue newValue)
           
 void load()
           
 void load(DistCacheLoadListener listener)
           
 CacheUpdateWithSource loadCacheStream(long requestVersion, boolean isValueStream)
           
 MnodeEntry loadMnodeValue()
          Returns the object for the given key, checking the backing if necessary
 MnodeUpdate localUpdate(MnodeUpdate update, java.io.InputStream is)
           
 void put(java.io.InputStream is)
          Sets the value by an input stream
 void put(java.io.InputStream is, long accessedExpireTimeout, long modifiedExpireTimeout)
          Sets the value by an input stream
 void put(java.io.InputStream is, long accessedExpireTimeout, long modifiedExpireTimeout, int flags)
          Sets the value by an input stream
 void put(java.io.InputStream is, long accessedExpireTimeout, long modifiedExpireTimeout, long lastAccessTime, long lastModifiedTime)
          Sets the value by an input stream
 void put(java.lang.Object value)
          Sets a cache entry
protected  void put(java.lang.Object value, long now, MnodeEntry mnodeEntry, boolean isWriteThrough)
          Sets a cache entry
 boolean putIfNew(MnodeUpdate update, java.io.InputStream is)
          Sets the value by an input stream
 void putIfNewer(long version, java.io.InputStream is)
          Sets the value by an input stream
 void putInternal(java.lang.Object value)
          Sets a cache entry
 void putLocal(java.io.InputStream is)
          Sets the value by an input stream
 MnodeEntry putLocalValue(MnodeEntry mnodeValue)
          Sets a cache entry
 MnodeValue putLocalValue(MnodeUpdate mnodeUpdate, java.io.InputStream is)
          Sets a cache entry
 MnodeEntry putLocalValue(MnodeUpdate mnodeUpdate, long valueDataId, java.lang.Object value)
          Sets a cache entry
 boolean readData(java.io.OutputStream os, CacheConfig config)
          Writes the data to a stream.
 boolean remove()
          Sets a cache entry
 void setKey(java.lang.Object key)
           
 java.lang.String toString()
           
protected  void updateAccessTime()
           
 void updateLease(int leaseOwner)
           
 void updateModifiedTime()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getKey

public final java.lang.Object getKey()
Returns the key for this entry in the Cache.


setKey

public final void setKey(java.lang.Object key)

getKeyHash

public final HashKey getKeyHash()
Returns the keyHash


getOwner

public final TriadOwner getOwner()
Returns the owner


getCacheKey

public HashKey getCacheKey()

getCacheKeyHash

public byte[] getCacheKeyHash()

getCache

public CacheHandle getCache()

getConfig

public CacheConfig getConfig()

getEngine

public CacheEngine getEngine()

getMnodeEntry

public final MnodeEntry getMnodeEntry()
Returns the value section of the entry.


get

public java.lang.Object get()
Returns the object for the given key, checking the backing if necessary. If it is not found, the optional cacheLoader is invoked, if present.


loadMnodeValue

public MnodeEntry loadMnodeValue()
Returns the object for the given key, checking the backing if necessary


getValueStream

public final StreamSource getValueStream()
Gets a cache entry as a stream


getValueHash

public long getValueHash(java.lang.Object value,
                         CacheConfig config)

loadCacheStream

public CacheUpdateWithSource loadCacheStream(long requestVersion,
                                             boolean isValueStream)

put

public final void put(java.lang.Object value)
Sets a cache entry


putInternal

public final void putInternal(java.lang.Object value)
Sets a cache entry


put

public void put(java.io.InputStream is)
         throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

putLocal

public void putLocal(java.io.InputStream is)
              throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

put

public void put(java.io.InputStream is,
                long accessedExpireTimeout,
                long modifiedExpireTimeout)
         throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

put

public void put(java.io.InputStream is,
                long accessedExpireTimeout,
                long modifiedExpireTimeout,
                long lastAccessTime,
                long lastModifiedTime)
         throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

put

public void put(java.io.InputStream is,
                long accessedExpireTimeout,
                long modifiedExpireTimeout,
                int flags)
         throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

putIfNewer

public void putIfNewer(long version,
                       java.io.InputStream is)
                throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

remove

public final boolean remove()
Sets a cache entry


putIfNew

public boolean putIfNew(MnodeUpdate update,
                        java.io.InputStream is)
                 throws java.io.IOException
Sets the value by an input stream

Throws:
java.io.IOException

compareAndPut

public boolean compareAndPut(long testValue,
                             java.lang.Object value)

compareAndPutLocal

public final boolean compareAndPutLocal(long testValue,
                                        MnodeUpdate update,
                                        StreamSource source)

compareAndPutLocal

public boolean compareAndPutLocal(long testValueHash,
                                  MnodeUpdate update,
                                  long valueDataId,
                                  java.lang.Object value)

compareAndPut

protected boolean compareAndPut(DistCacheEntry entry,
                                long testValue,
                                MnodeUpdate mnodeUpdate,
                                long valueDataId,
                                java.lang.Object value,
                                CacheConfig config)

getAndRemove

public java.lang.Object getAndRemove()
Remove the value


getAndReplace

public java.lang.Object getAndReplace(long testValue,
                                      java.lang.Object value)

getAndPut

public java.lang.Object getAndPut(java.lang.Object value)
Sets the current value


getAndPut

protected final java.lang.Object getAndPut(java.lang.Object value,
                                           long now,
                                           MnodeEntry mnodeValue)
Sets a cache entry


getAndPutLocal

public long getAndPutLocal(MnodeUpdate mnodeUpdate,
                           StreamSource source)

getAndPutLocal

public long getAndPutLocal(DistCacheEntry entry,
                           MnodeUpdate mnodeUpdate,
                           long valueDataId,
                           java.lang.Object value)

compareAndSetEntry

public final boolean compareAndSetEntry(MnodeEntry oldMnodeValue,
                                        MnodeEntry mnodeValue)
Sets the current value.


readData

public boolean readData(java.io.OutputStream os,
                        CacheConfig config)
                 throws java.io.IOException
Writes the data to a stream.

Throws:
java.io.IOException

isModified

public boolean isModified(MnodeValue newValue)

clearLease

public void clearLease(int oldLeaseOwner)

clearLease

public void clearLease()

isLeaseExpired

public boolean isLeaseExpired()

updateLease

public void updateLease(int leaseOwner)

getCost

public long getCost()

load

public void load()

load

public void load(DistCacheLoadListener listener)

getValueHash

public long getValueHash()

getVersion

public long getVersion()

getValue

public java.lang.Object getValue()

getStream

public final boolean getStream(java.io.OutputStream os)
                        throws java.io.IOException
Gets a cache entry as a stream

Throws:
java.io.IOException

getLocalStream

public final boolean getLocalStream(java.io.OutputStream os)
                             throws java.io.IOException
Gets a cache entry as a stream

Throws:
java.io.IOException

localUpdate

public MnodeUpdate localUpdate(MnodeUpdate update,
                               java.io.InputStream is)

putLocalValue

public final MnodeValue putLocalValue(MnodeUpdate mnodeUpdate,
                                      java.io.InputStream is)
Sets a cache entry


putLocalValue

public final MnodeEntry putLocalValue(MnodeUpdate mnodeUpdate,
                                      long valueDataId,
                                      java.lang.Object value)
Sets a cache entry


put

protected final void put(java.lang.Object value,
                         long now,
                         MnodeEntry mnodeEntry,
                         boolean isWriteThrough)
Sets a cache entry


putLocalValue

public final MnodeEntry putLocalValue(MnodeEntry mnodeValue)
Sets a cache entry


updateModifiedTime

public void updateModifiedTime()

updateAccessTime

protected final void updateAccessTime()

clear

public void clear()
Invalidates the entry


getLoadCount

public int getLoadCount()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object