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 |
protected V |
value |
TIME_NOT_SET
Constructor and Description |
---|
AbstractNearCacheRecord(V value,
long creationTime,
long expirationTime) |
Modifier and Type | Method and Description |
---|---|
int |
getAccessHit()
Gets the access hit count of this
Evictable . |
long |
getAccessTime()
Gets the latest access time difference of this
Evictable in milliseconds. |
long |
getCreationTime()
Gets the creation time of this
Evictable in milliseconds. |
long |
getExpirationTime()
Gets the expiration time in milliseconds.
|
V |
getValue()
Gets the value of this
NearCacheRecord . |
void |
incrementAccessHit()
Increases the access hit count of this
Evictable as 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 |
setValue(V value)
Sets the value of this
NearCacheRecord . |
protected V value
protected long creationTime
protected volatile long expirationTime
protected volatile long accessTime
protected volatile int accessHit
public AbstractNearCacheRecord(V value, long creationTime, long expirationTime)
public V getValue()
NearCacheRecord
NearCacheRecord
.getValue
in interface NearCacheRecord<V>
NearCacheRecord
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
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 getAccessTime()
Evictable
Evictable
in milliseconds.getAccessTime
in interface Evictable
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
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
as 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 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
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.