Table of Contents

Interface ICacheEnumerable<TKey>

Namespace
Cuemon.Runtime.Caching
Assembly
Cuemon.Runtime.Caching.dll

An interface that is used to provide cache implementations for an application.

public interface ICacheEnumerable<TKey> : IEnumerable<KeyValuePair<TKey, CacheEntry>>, IEnumerable

Type Parameters

TKey

The type of the key in the cache.

Inherited Members

Properties

Item[String, String]

Gets or sets a value in the cache by using the default indexer property for an instance of the SlimMemoryCache class.

object this[string key, string ns = null ] { get; set; }

Parameters

key String

The unique identifier for the cache value to get or set.

ns String

The optional named group associated with the cache value.

Property Value

Object

The value in the cache for the specified key, if the entry exists; otherwise, null.

KeyProvider

Gets the function delegate that is responsible for providing a unique identifier for the cache entry.

Func<string, string, TKey> KeyProvider { get; }

Property Value

Func<String, String, TKey>

The function delegate that is responsible for providing a unique identifier for the cache entry.

Methods

Add(CacheEntry, CacheInvalidation)

Inserts a cache entry into the cache as a CacheEntry instance, and adds details about how the entry should be evicted.

bool Add(CacheEntry entry, CacheInvalidation invalidation)

Parameters

entry CacheEntry

The object representing the cached value for a cache entry.

invalidation CacheInvalidation

The object that contains expiration details for a specific cache entry.

Returns

Boolean

Contains(String, String)

Determines whether a cache entry exists in the cache.

bool Contains(string key, string ns = null)

Parameters

key String

The unique identifier for the cache entry.

ns String

The optional namespace that provides a scope to the cache.

Returns

Boolean

true if the cache contains a cache entry whose key matches key; otherwise, false.

Count(String)

Gets the number of entries associated with the ns contained in the cache.

int Count(string ns = null)

Parameters

ns String

The optional namespace that provides a scope to the cache.

Returns

Int32

The number of entries contained in the cache.

Get(String, String)

Returns an entry from the cache.

object Get(string key, string ns = null)

Parameters

key String

The unique identifier for the cache entry.

ns String

The optional namespace that provides a scope to the cache.

Returns

Object

A reference to the value in the cache container that is identified by key, if the entry exists; otherwise, null.

GetCacheEntry(String, String)

Returns an entry from the cache as a CacheEntry instance.

CacheEntry GetCacheEntry(string key, string ns = null)

Parameters

key String

The unique identifier for the cache entry.

ns String

The optional namespace that provides a scope to the cache.

Returns

CacheEntry

A reference to the CacheEntry that is identified by key, if the entry exists; otherwise, null.

Remove(String, String)

Removes a cache entry from the cache.

object Remove(string key, string ns = null)

Parameters

key String

The unique identifier for the cache entry.

ns String

The optional namespace that provides a scope to the cache.

Returns

Object

If the entry is found in the cache, a reference to the value in the cache container of the removed cache entry; otherwise, null.

RemoveAll(String)

Removes all entries associated with the ns contained in the cache.

void RemoveAll(string ns = null)

Parameters

ns String

The optional namespace that provides a scope to the cache.

Set(String, Object, CacheInvalidation, String)

Inserts a cache entry into the cache.

void Set(string key, object value, CacheInvalidation invalidation, string ns = null)

Parameters

key String

The unique identifier of the cache.

value Object

The stored value of the cache.

invalidation CacheInvalidation

The object that contains expiration details for a specific cache entry.

ns String

The optional namespace that provides a scope to the cache.

TryGet(String, out Object)

Attempts to get the value associated with the specified key from the cache.

bool TryGet(string key, out object value)

Parameters

key String

The unique identifier for the cache entry.

value Object

When this method returns, contains the value associated with the specified key, or null if the operation failed.

Returns

Boolean

true if the value was found in the cache; otherwise, false.

TryGet(String, String, out Object)

Attempts to get the value associated with the specified key and ns from the cache.

bool TryGet(string key, string ns, out object value)

Parameters

key String

The unique identifier for the cache entry.

ns String

The optional namespace that provides a scope to the cache.

value Object

When this method returns, contains the value associated with the specified key and ns, or null if the operation failed.

Returns

Boolean

true if the value was found in the cache; otherwise, false.

TryGetCacheEntry(String, out CacheEntry)

Attempts to get the CacheEntry associated with the specified key from the cache.

bool TryGetCacheEntry(string key, out CacheEntry cacheEntry)

Parameters

key String

The unique identifier for the cache entry.

cacheEntry CacheEntry

When this method returns, contains the cache entry associated with the specified key, or null if the operation failed.

Returns

Boolean

true if the cacheEntry was found in the cache; otherwise, false.

TryGetCacheEntry(String, String, out CacheEntry)

Attempts to get the CacheEntry associated with the specified key and ns from the cache.

bool TryGetCacheEntry(string key, string ns, out CacheEntry cacheEntry)

Parameters

key String

The unique identifier for the cache entry.

ns String

The optional namespace that provides a scope to the cache.

cacheEntry CacheEntry

When this method returns, contains the cache entry associated with the specified key and ns, or null if the operation failed.

Returns

Boolean

true if the cacheEntry was found in the cache; otherwise, false.