V
- the type of the value stored by this AbstractNearCacheRecord
public abstract class AbstractNearCacheRecord<V> extends Object implements NearCacheRecord<V>
NearCacheRecord
with value and
expiration time as internal state.Modifier and Type | Field and Description |
---|---|
protected int |
accessHit |
protected long |
accessTime |
protected long |
creationTime |
protected long |
expirationTime |
static int |
NUMBER_OF_INTEGER_FIELD_TYPES |
static int |
NUMBER_OF_LONG_FIELD_TYPES |
protected long |
recordState |
protected long |
sequence |
protected UUID |
uuid |
protected V |
value |
NOT_RESERVED, READ_PERMITTED, RESERVED, TIME_NOT_SET, UPDATE_STARTED
Constructor and Description |
---|
AbstractNearCacheRecord(V value,
long creationTime,
long expirationTime) |
Modifier and Type | Method and Description |
---|---|
boolean |
casRecordState(long expect,
long update) |
int |
getAccessHit()
Gets the access hit count of this
Evictable . |
long |
getCreationTime()
Gets the creation time of this
Evictable in milliseconds. |
long |
getExpirationTime()
Gets the expiration time in milliseconds.
|
long |
getInvalidationSequence() |
long |
getLastAccessTime()
Gets the latest access time difference of this
Evictable in milliseconds. |
long |
getRecordState() |
V |
getValue()
Gets the value of this
Evictable . |
boolean |
hasSameUuid(UUID thatUuid) |
void |
incrementAccessHit()
Increases the access hit count of this
Evictable by 1 . |
boolean |
isExpiredAt(long now)
Checks whether the expiration time is passed with respect to the provided time.
|
boolean |
isIdleAt(long maxIdleMilliSeconds,
long now)
Checks whether the maximum idle time is passed with respect to the provided time
without any access during this time period as
maxIdleSeconds . |
void |
resetAccessHit()
Resets the access hit count of this
Evictable to 0 . |
void |
setAccessHit(int accessHit)
Sets the access hit count of this
Evictable . |
void |
setAccessTime(long accessTime)
Sets the access time of this
Evictable in milliseconds. |
void |
setCreationTime(long creationTime)
Sets the creation time of this
Evictable in milliseconds. |
void |
setExpirationTime(long expirationTime)
Sets the expiration time in milliseconds.
|
void |
setInvalidationSequence(long sequence) |
void |
setUuid(UUID uuid) |
void |
setValue(V value)
Sets the value of this
NearCacheRecord . |
String |
toString() |
public static final int NUMBER_OF_LONG_FIELD_TYPES
public static final int NUMBER_OF_INTEGER_FIELD_TYPES
protected long creationTime
protected long sequence
protected UUID uuid
protected volatile V value
protected volatile long expirationTime
protected volatile long accessTime
protected volatile long recordState
protected volatile int accessHit
public AbstractNearCacheRecord(V value, long creationTime, long expirationTime)
public V getValue()
Evictable
Evictable
.public void setValue(V value)
NearCacheRecord
NearCacheRecord
.setValue
in interface NearCacheRecord<V>
value
- the value for this NearCacheRecord
public long getExpirationTime()
Expirable
getExpirationTime
in interface Expirable
System.currentTimeMillis()
public void setExpirationTime(long expirationTime)
Expirable
setExpirationTime
in interface Expirable
System.currentTimeMillis()
public long getCreationTime()
Evictable
Evictable
in milliseconds.getCreationTime
in interface Evictable<V>
Evictable
in millisecondspublic void setCreationTime(long creationTime)
NearCacheRecord
Evictable
in milliseconds.setCreationTime
in interface NearCacheRecord<V>
creationTime
- the creation time for this Evictable
in millisecondspublic long getLastAccessTime()
Evictable
Evictable
in milliseconds.getLastAccessTime
in interface Evictable<V>
Evictable
in millisecondspublic void setAccessTime(long accessTime)
NearCacheRecord
Evictable
in milliseconds.setAccessTime
in interface NearCacheRecord<V>
accessTime
- the latest access time of this Evictable
in millisecondspublic int getAccessHit()
Evictable
Evictable
.getAccessHit
in interface Evictable<V>
Evictable
public void setAccessHit(int accessHit)
NearCacheRecord
Evictable
.setAccessHit
in interface NearCacheRecord<V>
accessHit
- the access hit count for this Evictable
public void incrementAccessHit()
NearCacheRecord
Evictable
by 1
.incrementAccessHit
in interface NearCacheRecord<V>
public void resetAccessHit()
NearCacheRecord
Evictable
to 0
.resetAccessHit
in interface NearCacheRecord<V>
public boolean isExpiredAt(long now)
Expirable
Returns true if and only if now > getExpirationTime()
isExpiredAt
in interface Expirable
now
- time in milliseconds.public long getInvalidationSequence()
getInvalidationSequence
in interface NearCacheRecord<V>
public void setInvalidationSequence(long sequence)
setInvalidationSequence
in interface NearCacheRecord<V>
sequence
- last known invalidation sequence at time of this records' creationpublic boolean hasSameUuid(UUID thatUuid)
hasSameUuid
in interface NearCacheRecord<V>
true
if supplied uuid equals existing one, otherwise and when one of supplied
or existing is null returns false
public void setUuid(UUID uuid)
setUuid
in interface NearCacheRecord<V>
uuid
- last known uuid of invalidation source at time of this records' creationpublic boolean isIdleAt(long maxIdleMilliSeconds, long now)
NearCacheRecord
maxIdleSeconds
.isIdleAt
in interface NearCacheRecord<V>
maxIdleMilliSeconds
- maximum idle time in millisecondsnow
- current time in millisecondstrue
if exceeds max idle seconds, otherwise false
public long getRecordState()
getRecordState
in interface NearCacheRecord<V>
public boolean casRecordState(long expect, long update)
casRecordState
in interface NearCacheRecord<V>
expect
- expected valueupdate
- updated valuetrue
if successful. False return indicates that
the actual value was not equal to the expected value.Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.