Class CacheRec
Stores cached item (such as a business object) along with additional caching information about it. The instance of this class gets reused for the same Key, so Key is immutable field. The instance of this class is returned by table.Get(key...) so the calling thread may see different Value property with time as it may be dynamically changed by some other thread (the newer value for the same Key)
Implements
Inherited Members
Namespace: Azos.Data.Access.Cache
Assembly: Azos.dll
Syntax
public sealed class CacheRec : Bucketed, IDisposable
Fields
Key
Key is immutable because CacheRec is returned by table.Get(key)
Declaration
public readonly ulong Key
Field Value
Type | Description |
---|---|
System.UInt64 |
Metadata
Stores arbitrary information about this item
Declaration
public volatile object Metadata
Field Value
Type | Description |
---|---|
System.Object |
Properties
AbsoluteExpirationUTC
Returns absolute expiration timestamp for this item or null
Declaration
public DateTime? AbsoluteExpirationUTC { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
AgeSec
Returns an approximate age of the item in seconds - an interval since this item was put into the store for the last time
Declaration
public int AgeSec { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
HitCount
Returns how many times this cache item was hit (resulted in successful read)
Declaration
public int HitCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxAgeSec
Returns positive integer that specifies the maximum lifespan duration for this item expressed in seconds, or zero. Zero is returned when this item does not have specific lifespan defined and will be evicted from cache per lifespan specified on the table level: Table.MaxAgeSec (default)
Declaration
public int MaxAgeSec { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Priority
Returns an integer value that dictates item priority relative to other items in the same table. Priorities play a role during cache collision as an item with higher priority is not going to be replaced by an item with lower priority
Declaration
public int Priority { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Value
Returns the value - a reference to cached item such as a business object
Declaration
public object Value { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
Destructor()
Declaration
protected override void Destructor()
Overrides
ValueAs<T>()
Returns typecast value
Declaration
public T ValueAs<T>()
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |