Show / Hide Table of Contents

Interface ICacheTable<TKey>

Inherited Members
ICacheTable.Cache
ICacheTable.Count
ICacheTable.Capacity
ICacheTable.LoadFactor
ICacheTable.Options
ICacheTable.CollisionMode
ICacheTable.Purge()
INamed.Name
Namespace: NFX.ApplicationModel.Pile
Assembly: NFX.dll
Syntax
public interface ICacheTable<TKey> : ICacheTable, INamed
Type Parameters
Name Description
TKey

Properties

KeyComparer

Returns equality comparer for keys, or null to use default Equals

Declaration
IEqualityComparer<TKey> KeyComparer { get; }
Property Value
Type Description
System.Collections.Generic.IEqualityComparer<TKey>

Methods

AsEnumerable(Boolean)

Returns the table as enumerable of entries with optional materialization of values (which is slower). Materialization is guaranteed to be consistent with the key

Declaration
IEnumerable<ICacheEntry<TKey>> AsEnumerable(bool withValues)
Parameters
Type Name Description
System.Boolean withValues

True, to materialize internal PilePointers into CLR objects

Returns
Type Description
System.Collections.Generic.IEnumerable<ICacheEntry<TKey>>

ContainsKey(TKey, Int32)

Returns true if cache has object with the key, optionally filtering-out objects older than ageSec param if it is > zero. Returns false if there is no object with the specified key or it is older than ageSec limit.

Declaration
bool ContainsKey(TKey key, int ageSec = 0)
Parameters
Type Name Description
TKey key
System.Int32 ageSec
Returns
Type Description
System.Boolean

Get(TKey, Int32)

Gets cache object by key, optionally filtering-out objects older than ageSec param if it is > zero. Returns null if there is no object with the specified key or it is older than ageSec limit.

Declaration
object Get(TKey key, int ageSec = 0)
Parameters
Type Name Description
TKey key
System.Int32 ageSec
Returns
Type Description
System.Object

GetOrPut(TKey, Func<ICacheTable<TKey>, TKey, Object, Object>, Object, out Nullable<PutResult>, Int32, Int32, Int32, Nullable<DateTime>)

Atomically tries to get object by key if it exists, otherwise calls a factory method under lock and puts the data with the specified parameters. 'newPutResult' returns the result of the put after factory method call. Keep in mind, that even if a factory method created a new object, there may be a case when the value could not be physically inserted in the cache because of a collision (data with higher priority occupies space and space is capped), so check for 'newPutResult' value which is null in case of getting an existing item. Returns object that was gotten or created anew

Declaration
object GetOrPut(TKey key, Func<ICacheTable<TKey>, TKey, object, object> valueFactory, object factoryContext, out PutResult? newPutResult, int ageSec = 0, int putMaxAgeSec = 0, int putPriority = 0, DateTime? putAbsoluteExpirationUTC = default (DateTime? ))
Parameters
Type Name Description
TKey key
System.Func<ICacheTable<TKey>, TKey, System.Object, System.Object> valueFactory
System.Object factoryContext
System.Nullable<PutResult> newPutResult
System.Int32 ageSec
System.Int32 putMaxAgeSec
System.Int32 putPriority
System.Nullable<System.DateTime> putAbsoluteExpirationUTC
Returns
Type Description
System.Object

GetPointer(TKey, Int32)

Gets cache object pointer by key, optionally filtering-out objects older than ageSec param if it is > zero. Returns invalid pointer if there is no object with the specified key or it is older than ageSec limit.

Declaration
PilePointer GetPointer(TKey key, int ageSec = 0)
Parameters
Type Name Description
TKey key
System.Int32 ageSec
Returns
Type Description
PilePointer

Put(TKey, Object, Nullable<Int32>, Int32, Nullable<DateTime>)

Puts an object identified by a key into cache returning the result of the put. For example, put may have added nothing if the table is capped and the space is occupied with data of higher priority

Declaration
PutResult Put(TKey key, object obj, int ? maxAgeSec = default (int ? ), int priority = 0, DateTime? absoluteExpirationUTC = default (DateTime? ))
Parameters
Type Name Description
TKey key

A table-wide unique obvject key

System.Object obj

An object to put

System.Nullable<System.Int32> maxAgeSec

If null then the default maxAgeSec is taken from Options property, otherwise specifies the length of items life in seconds

System.Int32 priority

The priority of this item. If there is no space in future the items with lower priorities will not evict existing data with highr priorities

System.Nullable<System.DateTime> absoluteExpirationUTC

Optional UTC timestamp of object eviction from cache

Returns
Type Description
PutResult

The status of put - whether item was inserted/replaced(if key exists)/overwritten or collided with higher-prioritized existing data

PutPointer(TKey, PilePointer, Nullable<Int32>, Int32, Nullable<DateTime>)

Puts a pointer identified by a key into cache returning the result of the put. For example, put may have added nothing if the table is capped and the space is occupied with data of higher priority

Declaration
PutResult PutPointer(TKey key, PilePointer ptr, int ? maxAgeSec = default (int ? ), int priority = 0, DateTime? absoluteExpirationUTC = default (DateTime? ))
Parameters
Type Name Description
TKey key

A table-wide unique obvject key

PilePointer ptr

A valid pointer to put

System.Nullable<System.Int32> maxAgeSec

If null then the default maxAgeSec is taken from Options property, otherwise specifies the length of items life in seconds

System.Int32 priority

The priority of this item. If there is no space in future the items with lower priorities will not evict existing data with highr priorities

System.Nullable<System.DateTime> absoluteExpirationUTC

Optional UTC timestamp of object eviction from cache

Returns
Type Description
PutResult

The status of put - whether item was inserted/replaced(if key exists)/overwritten or collided with higher-prioritized existing data

Rejuvenate(TKey)

Resets internal object age returning true of object was found and rejuvenated

Declaration
bool Rejuvenate(TKey key)
Parameters
Type Name Description
TKey key
Returns
Type Description
System.Boolean

Remove(TKey)

Removes data by key returning true if found and removed

Declaration
bool Remove(TKey key)
Parameters
Type Name Description
TKey key
Returns
Type Description
System.Boolean

SizeOfValue(TKey, Int32)

Returns the size of stored object if cache has object with the key, optionally filtering-out objects older than ageSec param if it is > zero.

Declaration
long SizeOfValue(TKey key, int ageSec = 0)
Parameters
Type Name Description
TKey key
System.Int32 ageSec
Returns
Type Description
System.Int64

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX