org.infinispan.container.entries
Class TransientMortalCacheEntry

java.lang.Object
  extended by org.infinispan.container.entries.AbstractInternalCacheEntry
      extended by org.infinispan.container.entries.TransientCacheEntry
          extended by org.infinispan.container.entries.TransientMortalCacheEntry
All Implemented Interfaces:
Serializable, CacheEntry, InternalCacheEntry

public class TransientMortalCacheEntry
extends TransientCacheEntry

A cache entry that is both transient and mortal.

Since:
4.0
Author:
Manik Surtani
See Also:
Serialized Form

Constructor Summary
TransientMortalCacheEntry(Object key, Object value, long maxIdle, long lifespan, long lastUsed, long created)
           
 
Method Summary
 boolean equals(Object o)
           
 long getCreated()
           
 long getExpiryTime()
          Only used with entries that have a lifespan, this determines when an entry is due to expire.
 long getLifespan()
           
 int hashCode()
           
 boolean isExpired()
           
 InternalCacheEntry setLifespan(long lifespan)
          Sets the lifespan of the entry.
 InternalCacheEntry setMaxIdle(long maxIdle)
          Sets the maximum idle time of the entry.
 
Methods inherited from class org.infinispan.container.entries.TransientCacheEntry
canExpire, getLastUsed, getMaxIdle, touch
 
Methods inherited from class org.infinispan.container.entries.AbstractInternalCacheEntry
commit, getKey, getValue, isChanged, isCreated, isNull, isRemoved, isValid, rollback, setCreated, setRemoved, setValid, setValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransientMortalCacheEntry

public TransientMortalCacheEntry(Object key,
                                 Object value,
                                 long maxIdle,
                                 long lifespan,
                                 long lastUsed,
                                 long created)
Method Detail

setLifespan

public InternalCacheEntry setLifespan(long lifespan)
Description copied from interface: CacheEntry
Sets the lifespan of the entry.

Note that if this method is used, you should always use a reference to the return value after invocation, since as an optimization, implementations may change type of CacheEntry used after invoking this method, for example changing a MortalCacheEntry to an ImmortalCacheEntry.

Specified by:
setLifespan in interface CacheEntry
Specified by:
setLifespan in interface InternalCacheEntry
Overrides:
setLifespan in class TransientCacheEntry
Parameters:
lifespan - lifespan to set
Returns:
the updated CacheEntry

setMaxIdle

public InternalCacheEntry setMaxIdle(long maxIdle)
Description copied from interface: CacheEntry
Sets the maximum idle time of the entry.

Note that if this method is used, you should always use a reference to the return value after invocation, since as an optimization, implementations may change type of CacheEntry used after invoking this method, for example changing a MortalCacheEntry to an ImmortalCacheEntry.

Specified by:
setMaxIdle in interface CacheEntry
Specified by:
setMaxIdle in interface InternalCacheEntry
Overrides:
setMaxIdle in class TransientCacheEntry
Parameters:
maxIdle - maxIdle to set
Returns:
the updated CacheEntry

getLifespan

public long getLifespan()
Specified by:
getLifespan in interface CacheEntry
Overrides:
getLifespan in class TransientCacheEntry
Returns:
retrieves the lifespan of this entry. -1 means an unlimited lifespan.

getCreated

public long getCreated()
Specified by:
getCreated in interface InternalCacheEntry
Overrides:
getCreated in class TransientCacheEntry
Returns:
timestamp when the entry was created

isExpired

public boolean isExpired()
Specified by:
isExpired in interface InternalCacheEntry
Overrides:
isExpired in class TransientCacheEntry
Returns:
true if the entry has expired; false otherwise

getExpiryTime

public final long getExpiryTime()
Description copied from interface: InternalCacheEntry
Only used with entries that have a lifespan, this determines when an entry is due to expire.

Specified by:
getExpiryTime in interface InternalCacheEntry
Overrides:
getExpiryTime in class TransientCacheEntry
Returns:
timestamp when the entry is due to expire, or -1 if it doesn't have a lifespan

equals

public boolean equals(Object o)
Overrides:
equals in class TransientCacheEntry

hashCode

public int hashCode()
Overrides:
hashCode in class TransientCacheEntry


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.