Table of Contents

Add Method

Definition

Namespace
Cuemon.Runtime.Caching
Assemblies
Cuemon.Runtime.Caching.dll
Source
src/Cuemon.Runtime.Caching/SlimMemoryCache.cs

Add(string, object, DateTime, string)

Inserts a cache entry into the cache and adds details about how the entry should be evicted.

public bool Add(string key, object value, DateTime absoluteExpiration, string ns = null)

Parameters

key string

The unique identifier of the cache.

value object

The stored value of the cache.

absoluteExpiration DateTime

The absolute expiration date time value from when the cached value becomes invalid and is removed from the cache.

ns string

The optional namespace that provides a scope to the cache.

Returns

bool

true if insertion succeeded; otherwise, false when there is already an entry in the cache with the same key.

Exceptions

ArgumentNullException

key cannot be null.

Add(string, object, IDependency, string)

Inserts a cache entry into the cache and adds details about how the entry should be evicted.

public bool Add(string key, object value, IDependency dependency, string ns = null)

Parameters

key string

The unique identifier of the cache.

value object

The stored value of the cache.

dependency IDependency

An IDependency implementations that monitors changes in the state of the data which a cache entry depends on. If a state change is registered, the cached value becomes invalid and is removed from the cache.

ns string

The optional namespace that provides a scope to the cache.

Returns

bool

true if insertion succeeded; otherwise, false when there is already an entry in the cache with the same key.

Exceptions

ArgumentNullException

key cannot be null.

Add(string, object, IEnumerable<IDependency>, string)

Inserts a cache entry into the cache and adds details about how the entry should be evicted.

public bool Add(string key, object value, IEnumerable<IDependency> dependencies, string ns = null)

Parameters

key string

The unique identifier of the cache.

value object

The stored value of the cache.

dependencies IEnumerable<IDependency>

A sequence of IDependency implementations that monitors changes in the state of the data which a cache entry depends on. If a state change is registered, the cached value becomes invalid and is removed from the cache.

ns string

The optional namespace that provides a scope to the cache.

Returns

bool

true if insertion succeeded; otherwise, false when there is already an entry in the cache with the same key.

Exceptions

ArgumentNullException

key cannot be null.

Add(string, object, TimeSpan, string)

Inserts a cache entry into the cache and adds details about how the entry should be evicted.

public bool Add(string key, object value, TimeSpan slidingExpiration, string ns = null)

Parameters

key string

The unique identifier of the cache.

value object

The stored value of the cache.

slidingExpiration TimeSpan

The sliding expiration time from when the cached value becomes invalid and is removed from the cache.

ns string

The optional namespace that provides a scope to the cache.

Returns

bool

true if insertion succeeded; otherwise, false when there is already an entry in the cache with the same key.

Exceptions

ArgumentNullException

key cannot be null.

Add(CacheEntry, CacheInvalidation)

Inserts a cache entry into the cache and adds details about how the entry should be evicted.

public 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

bool

true if insertion succeeded; otherwise, false when there is already an entry in the cache with the same key.

Exceptions

ArgumentNullException

entry cannot be null -or- invalidation cannot be null.