Table of Contents

Class MemoryCacheManager

Namespace
Dynamicweb.Caching
Assembly
Dynamicweb.Caching.dll
MemoryCacheManager class. Threadsafe
public class MemoryCacheManager : ICacheManager
Inheritance
MemoryCacheManager
Implements
Inherited Members

Properties

AllKeys

Gets all keys currently in the cache.
public IEnumerable<string> AllKeys { get; }

Property Value

IEnumerable<string>
All keys.
See Also

IsValid

Returns true if the cache manager is valid.
public bool IsValid { get; }

Property Value

bool
true if cache manager is valid; otherwise, false.
See Also

this[string]

Gets or sets the object with the specified key.
public object this[string key] { get; set; }

Parameters

key string
The key.

Property Value

object
Cache entry for the specified key if it exists; null otherwise.
See Also

Methods

Add<T>(string, T)

Adds the given cache item into the cache using the specified key.
[Obsolete("Use Set instead.")]
public bool Add<T>(string key, T cacheItem)

Parameters

key string
The key.
cacheItem T
The cache item.

Returns

bool
true if the Add-operation succeeded, false otherwise.

Type Parameters

T
The type of the object to add.
See Also

Add<T>(string, T, CacheItemPolicy)

Adds the given cache item into the cache using the specified key.
[Obsolete("Use Set instead.")]
public bool Add<T>(string key, T cacheItem, CacheItemPolicy policy)

Parameters

key string
The key.
cacheItem T
The cache item.
policy CacheItemPolicy
The policy specifying cache behavior.

Returns

bool
true if the Add-operation succeeded, false otherwise.

Type Parameters

T
The type of the object to add.
See Also

AddOrUpdate<T>(string, T)

Adds or updates the cache entry for the specified key with the given cache item.
[Obsolete("Use Set instead.")]
public void AddOrUpdate<T>(string key, T cacheItem)

Parameters

key string
The key.
cacheItem T
The cache item.

Type Parameters

T
The type of the object to add.
See Also

AddOrUpdate<T>(string, T, CacheItemPolicy)

Adds or updates the cache entry for the specified key with the given cache item.
[Obsolete("Use Set instead.")]
public void AddOrUpdate<T>(string key, T cacheItem, CacheItemPolicy policy)

Parameters

key string
The key.
cacheItem T
The cache item.
policy CacheItemPolicy
The policy specifying cache behavior.

Type Parameters

T
The type of the object to add.
See Also

Contains(string)

Determines whether the cache contains an entry with the specified key.
public bool Contains(string key)

Parameters

key string
The key.

Returns

bool
true if a cache entry for the specified key exists; otherwise, false.
See Also

ForceClear()

Forcefully removes all keys from the cache.
public void ForceClear()
See Also

Get(string)

Gets the cache entry for the specified key.
public object Get(string key)

Parameters

key string
The key.

Returns

object
Cache entry for the specified key if it exists; null otherwise.
See Also

Get<T>(string)

Gets the cache entry for the specified key.
public T Get<T>(string key)

Parameters

key string
The key.

Returns

T
Cache entry for the specified key if it exists; null otherwise.

Type Parameters

T
The type of the cache entry object.

Exceptions

InvalidOperationException
If cache entry is not of type T and not null.
See Also

Remove(string)

Removes the cache entry for the specified key.
public virtual void Remove(string key)

Parameters

key string
The key.
See Also

Set(string, object)

Adds or updates the cache entry for the specified key with the given cache item.
public void Set(string key, object cacheItem)

Parameters

key string
The key.
cacheItem object
The cache item.
See Also

Set(string, object, CacheItemPolicy)

Sets the cache entry for the specified key with the given cache item.
public void Set(string key, object cacheItem, CacheItemPolicy policy)

Parameters

key string
The key.
cacheItem object
The cache item.
policy CacheItemPolicy
The policy specifying cache behavior.
See Also

TryGet<T>(string, out T)

Tries the get the cache entry for the specified key.
public bool TryGet<T>(string key, out T value)

Parameters

key string
The key.
value T
The value.

Returns

bool
true if the Get-operation succeeded, false otherwise.

Type Parameters

T
The type of the cache entry object.
See Also

See Also

To top