com.caucho.server.distcache
Class MnodeEntry

java.lang.Object
  extended by com.caucho.server.distcache.MnodeValue
      extended by com.caucho.server.distcache.MnodeEntry
All Implemented Interfaces:
ExtCacheEntry, java.io.Serializable, Cache.Entry

public final class MnodeEntry
extends MnodeValue
implements ExtCacheEntry

An entry in the cache map

See Also:
Serialized Form

Field Summary
static HashKey ANY_KEY
           
static MnodeEntry NULL
           
static HashKey NULL_KEY
           
 
Constructor Summary
MnodeEntry(HashKey valueHash, long valueLength, long version, java.lang.Object value, HashKey cacheHash, long flags, long accessedExpireTimeout, long modifiedExpireTimeout, long leaseTimeout, long lastAccessTime, long lastUpdateTime, boolean isServerVersionValid, boolean isImplicitNull)
           
MnodeEntry(MnodeEntry oldMnodeValue, long accessTimeout, long lastUpdateTime)
           
MnodeEntry(MnodeValue mnodeValue, java.lang.Object value, long leaseTimeout, long lastAccessTime, long lastUpdateTime, boolean isServerVersionValid, boolean isImplicitNull)
           
 
Method Summary
 void clearLease()
          Sets the owner
 int compareTo(MnodeEntry mnode)
          Compares values
 long getAccessExpireTimeoutWindow()
          Returns the idle window to avoid too many updates
 java.sql.Blob getBlob()
           
 HashKey getCacheHashKey()
           
 long getCreationTime()
           
 long getExpirationTime()
          Returns the expiration time
 int getHits()
           
 java.lang.Object getKey()
          Implements a method required by the interface that should never be called>
 HashKey getKeyHash()
          Returns the key hash for the current entry.
 long getLastAccessedTime()
          Returns the last access time.
 long getLastModifiedTime()
          Returns the last update time.
 long getLastRemoteAccessTime()
          Returns the last remote access time.
 int getLeaseOwner()
          Returns the lease owner
 long getLeaseTimeout()
          Returns the timeout for a lease of the cache entry
 int getLoadCount()
          Returns the load count.
 java.lang.Object getValue()
          Returns the deserialized value for the entry.
 HashKey getValueHashKey()
          Returns the value key
 boolean isExpired(long now)
          Returns true is the entry has expired for being idle or having expired.
 boolean isIdleExpired(long now)
          Returns true is the entry has remained idle too long.
 boolean isImplicitNull()
          If the null value is due to a missing item in the database.
 boolean isLeaseExpired(long now)
           
 boolean isLocalExpired(int serverIndex, long now, long localExpireTimeout)
           
 boolean isLocalExpired(long now, CacheConfig config)
          Returns true if the local (unchecked) expire time.
 boolean isServerVersionValid()
          Returns true if the server version (startup count) matches the database.
 boolean isUnloadedValue()
           
 boolean isValid()
           
 boolean isValueExpired(long now)
          Returns true if the value of the entry has expired.
 boolean isValueNull()
          Returns true if the value is null
 void setBlob(java.sql.Blob blob)
           
 void setLastAccessTime(long accessTime)
          Sets the last access time.
 void setLastRemoteAccessTime(long accessTime)
          Sets the last remote access time.
 void setLeaseOwner(int leaseOwner, long now)
          Sets the owner
 void setObjectValue(java.lang.Object value)
          Sets the deserialized value for the entry.
 java.lang.Object setValue(java.lang.Object value)
          Implements a method required by the interface that should never be called>
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.server.distcache.MnodeValue
getAccessedExpireTimeout, getCacheHash, getFlags, getModifiedExpireTimeout, getUserFlags, getValueHash, getValueLength, getVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.distcache.ExtCacheEntry
getAccessedExpireTimeout, getModifiedExpireTimeout, getUserFlags, getValueLength, getVersion
 

Field Detail

NULL

public static final MnodeEntry NULL

NULL_KEY

public static final HashKey NULL_KEY

ANY_KEY

public static final HashKey ANY_KEY
Constructor Detail

MnodeEntry

public MnodeEntry(HashKey valueHash,
                  long valueLength,
                  long version,
                  java.lang.Object value,
                  HashKey cacheHash,
                  long flags,
                  long accessedExpireTimeout,
                  long modifiedExpireTimeout,
                  long leaseTimeout,
                  long lastAccessTime,
                  long lastUpdateTime,
                  boolean isServerVersionValid,
                  boolean isImplicitNull)

MnodeEntry

public MnodeEntry(MnodeValue mnodeValue,
                  java.lang.Object value,
                  long leaseTimeout,
                  long lastAccessTime,
                  long lastUpdateTime,
                  boolean isServerVersionValid,
                  boolean isImplicitNull)

MnodeEntry

public MnodeEntry(MnodeEntry oldMnodeValue,
                  long accessTimeout,
                  long lastUpdateTime)
Method Detail

getKeyHash

public HashKey getKeyHash()
Description copied from interface: ExtCacheEntry
Returns the key hash for the current entry.

Specified by:
getKeyHash in interface ExtCacheEntry

getLastAccessedTime

public long getLastAccessedTime()
Returns the last access time.

Specified by:
getLastAccessedTime in interface ExtCacheEntry
Returns:

setLastAccessTime

public void setLastAccessTime(long accessTime)
Sets the last access time.


getLastRemoteAccessTime

public long getLastRemoteAccessTime()
Returns the last remote access time.


setLastRemoteAccessTime

public void setLastRemoteAccessTime(long accessTime)
Sets the last remote access time.


getLastModifiedTime

public long getLastModifiedTime()
Returns the last update time.

Specified by:
getLastModifiedTime in interface ExtCacheEntry

getExpirationTime

public final long getExpirationTime()
Returns the expiration time


isLocalExpired

public final boolean isLocalExpired(int serverIndex,
                                    long now,
                                    long localExpireTimeout)

isLeaseExpired

public final boolean isLeaseExpired(long now)

isLocalExpired

public final boolean isLocalExpired(long now,
                                    CacheConfig config)
Returns true if the local (unchecked) expire time.


isExpired

public final boolean isExpired(long now)
Returns true is the entry has expired for being idle or having expired.

Specified by:
isExpired in interface ExtCacheEntry

isValueExpired

public final boolean isValueExpired(long now)
Returns true if the value of the entry has expired.


isIdleExpired

public final boolean isIdleExpired(long now)
Returns true is the entry has remained idle too long.


getLeaseOwner

public final int getLeaseOwner()
Returns the lease owner

Specified by:
getLeaseOwner in interface ExtCacheEntry

setLeaseOwner

public final void setLeaseOwner(int leaseOwner,
                                long now)
Sets the owner


clearLease

public final void clearLease()
Sets the owner


getAccessExpireTimeoutWindow

public long getAccessExpireTimeoutWindow()
Returns the idle window to avoid too many updates


getLeaseTimeout

public long getLeaseTimeout()
Returns the timeout for a lease of the cache entry

Specified by:
getLeaseTimeout in interface ExtCacheEntry

setObjectValue

public final void setObjectValue(java.lang.Object value)
Sets the deserialized value for the entry.


isValueNull

public boolean isValueNull()
Returns true if the value is null

Specified by:
isValueNull in interface ExtCacheEntry

getValue

public final java.lang.Object getValue()
Returns the deserialized value for the entry.

Specified by:
getValue in interface ExtCacheEntry
Specified by:
getValue in interface Cache.Entry

getBlob

public java.sql.Blob getBlob()

setBlob

public void setBlob(java.sql.Blob blob)

getValueHashKey

public HashKey getValueHashKey()
Description copied from interface: ExtCacheEntry
Returns the value key

Specified by:
getValueHashKey in interface ExtCacheEntry

getCacheHashKey

public HashKey getCacheHashKey()

isServerVersionValid

public boolean isServerVersionValid()
Returns true if the server version (startup count) matches the database.


isImplicitNull

public boolean isImplicitNull()
If the null value is due to a missing item in the database.


isUnloadedValue

public boolean isUnloadedValue()

compareTo

public int compareTo(MnodeEntry mnode)
Compares values


getLoadCount

public int getLoadCount()
Description copied from interface: ExtCacheEntry
Returns the load count.

Specified by:
getLoadCount in interface ExtCacheEntry

getKey

public java.lang.Object getKey()
Implements a method required by the interface that should never be called>

Specified by:
getKey in interface Cache.Entry

setValue

public java.lang.Object setValue(java.lang.Object value)
Implements a method required by the interface that should never be called>


getCreationTime

public long getCreationTime()

isValid

public boolean isValid()
Specified by:
isValid in interface ExtCacheEntry

getHits

public int getHits()

toString

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