org.infinispan.container.entries
Interface CacheEntry

All Superinterfaces:
Serializable
All Known Subinterfaces:
InternalCacheEntry, MVCCEntry
All Known Implementing Classes:
AbstractInternalCacheEntry, ImmortalCacheEntry, MortalCacheEntry, NullMarkerEntry, NullMarkerEntryForRemoval, ReadCommittedEntry, RepeatableReadEntry, TransientCacheEntry, TransientMortalCacheEntry

public interface CacheEntry
extends Serializable

An entry that is stored in the data container

Since:
4.0
Author:
Manik Surtani

Method Summary
 void commit(DataContainer container)
          Commits changes
 Object getKey()
          Retrieves the key to this entry
 long getLifespan()
           
 long getMaxIdle()
           
 Object getValue()
          Retrieves the value of this entry
 boolean isChanged()
           
 boolean isCreated()
           
 boolean isNull()
          Tests whether the entry represents a null value, typically used for repeatable read.
 boolean isRemoved()
           
 boolean isValid()
           
 void rollback()
          Rolls back changes
 void setCreated(boolean created)
           
 CacheEntry setLifespan(long lifespan)
          Sets the lifespan of the entry.
 CacheEntry setMaxIdle(long maxIdle)
          Sets the maximum idle time of the entry.
 void setRemoved(boolean removed)
           
 void setValid(boolean valid)
           
 Object setValue(Object value)
          Sets the value of the entry, returing the previous value
 

Method Detail

isNull

boolean isNull()
Tests whether the entry represents a null value, typically used for repeatable read.

Returns:
true if this represents a null, false otherwise.

isChanged

boolean isChanged()
Returns:
true if this entry has changed since being read from the container, false otherwise.

isCreated

boolean isCreated()
Returns:
true if this entry has been newly created, false otherwise.

isRemoved

boolean isRemoved()
Returns:
true if this entry has been removed since being read from the container, false otherwise.

isValid

boolean isValid()
Returns:
true if this entry is still valid, false otherwise.

getKey

Object getKey()
Retrieves the key to this entry

Returns:
a key

getValue

Object getValue()
Retrieves the value of this entry

Returns:
the value of the entry

getLifespan

long getLifespan()
Returns:
retrieves the lifespan of this entry. -1 means an unlimited lifespan.

getMaxIdle

long getMaxIdle()
Returns:
the maximum allowed time for which this entry can be idle, after which it is considered expired.

setMaxIdle

CacheEntry setMaxIdle(long maxIdle)
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.

Parameters:
maxIdle - maxIdle to set
Returns:
the updated CacheEntry

setLifespan

CacheEntry setLifespan(long lifespan)
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.

Parameters:
lifespan - lifespan to set
Returns:
the updated CacheEntry

setValue

Object setValue(Object value)
Sets the value of the entry, returing the previous value

Parameters:
value - value to set
Returns:
previous value

commit

void commit(DataContainer container)
Commits changes

Parameters:
container - data container to commit to

rollback

void rollback()
Rolls back changes


setCreated

void setCreated(boolean created)

setRemoved

void setRemoved(boolean removed)

setValid

void setValid(boolean valid)


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