Class CacheRecord<V>
- java.lang.Object
-
- com.smartgridready.communicator.modbus.helper.CacheRecord<V>
-
- Type Parameters:
V- The type of value.
public class CacheRecord<V> extends java.lang.ObjectImplements a generic cache record.
-
-
Constructor Summary
Constructors Constructor Description CacheRecord(V value, java.time.Instant lastAccess)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VgetValue()Gets the cached value.booleanisExpired(java.lang.Long timeToLiveMs)Tells if the cache has expired.java.lang.StringtoString()
-
-
-
Constructor Detail
-
CacheRecord
public CacheRecord(V value, java.time.Instant lastAccess)
Constructs a new instance.- Parameters:
value- the value to cachelastAccess- the access time stamp
-
-
Method Detail
-
isExpired
public boolean isExpired(java.lang.Long timeToLiveMs)
Tells if the cache has expired.- Parameters:
timeToLiveMs- milliseconds after last access- Returns:
- a boolean
-
getValue
public V getValue()
Gets the cached value.- Returns:
- a value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-