Interface ICacheManager
- Namespace
- Dynamicweb.Caching
- Assembly
- Dynamicweb.Caching.dll
ICacheManager interface.
Defines the contract for a cache manager.
public interface ICacheManager
Properties
AllKeys
Gets all keys currently in the cache.
IEnumerable<string> AllKeys { get; }
Property Value
- IEnumerable<string>
- All keys.
IsValid
Returns true if the cache manager is valid.
bool IsValid { get; }
Property Value
- bool
trueif cache manager is valid; otherwise,false.
this[string]
Gets or sets the object with the specified key in the cache.
object this[string key] { get; set; }
Parameters
keystring- The key.
Property Value
- object
- System.Object.
Methods
Add<T>(string, T)
Adds the given cache item into the cache using the specified key.
[Obsolete("Use Set instead.")]
bool Add<T>(string key, T cacheItem)
Parameters
keystring- The key.
cacheItemT- The cache item.
Returns
- bool
trueif the Add-operation succeeded,falseotherwise.
Type Parameters
T- The type of the object to add.
Add<T>(string, T, CacheItemPolicy)
Adds the given cache item into the cache using the specified key.
[Obsolete("Use Set instead.")]
bool Add<T>(string key, T cacheItem, CacheItemPolicy policy)
Parameters
keystring- The key.
cacheItemT- The cache item.
policyCacheItemPolicy- The policy specifying cache behavior.
Returns
- bool
trueif the Add-operation succeeded,falseotherwise.
Type Parameters
T- The type of the object to add.
AddOrUpdate<T>(string, T)
Adds or updates the cache entry for the specified key with the given cache item.
[Obsolete("Use Set instead.")]
void AddOrUpdate<T>(string key, T cacheItem)
Parameters
keystring- The key.
cacheItemT- The cache item.
Type Parameters
T- The type of the object to add.
AddOrUpdate<T>(string, T, CacheItemPolicy)
Adds or updates the cache entry for the specified key with the given cache item.
[Obsolete("Use Set instead.")]
void AddOrUpdate<T>(string key, T cacheItem, CacheItemPolicy policy)
Parameters
keystring- The key.
cacheItemT- The cache item.
policyCacheItemPolicy- The policy specifying cache behavior.
Type Parameters
T- The type of the object to add.
Contains(string)
Determines whether the cache contains an entry with the specified key.
bool Contains(string key)
Parameters
keystring- The key.
Returns
- bool
trueif a cache entry for the specified key exists; otherwise,false.
Get(string)
Gets the cache entry for the specified key.
object Get(string key)
Parameters
keystring- The key.
Returns
- object
- System.Object.
Get<T>(string)
Gets the cache entry for the specified key.
T Get<T>(string key)
Parameters
keystring- The key.
Returns
- T
- T.
Type Parameters
T- The type of the cache entry object.
Remove(string)
Removes the cache entry for the specified key.
void Remove(string key)
Parameters
keystring- The key.
Set(string, object)
Adds or updates the cache entry for the specified key with the given cache item.
void Set(string key, object cacheItem)
Parameters
Set(string, object, CacheItemPolicy)
Sets the cache entry for the specified key with the given cache item.
void Set(string key, object cacheItem, CacheItemPolicy policy)
Parameters
keystring- The key.
cacheItemobject- The cache item.
policyCacheItemPolicy- The policy specifying cache behavior.
TryGet<T>(string, out T)
Tries the get the cache entry for the specified key.
bool TryGet<T>(string key, out T value)
Parameters
keystring- The key.
valueT- The value.
Returns
- bool
trueif the Get-operation succeeded,falseotherwise.
Type Parameters
T- The type of the cache entry object.