Class CacheHelper
Class that is exposed by the ApplicationContext for application wide caching purposes
Inheritance
System.Object
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
Constructors
CacheHelper()
Initializes a new instance for use in the web
Declaration
CacheHelper(Cache)
Initializes a new instance for use in the web
Declaration
public CacheHelper(Cache cache)
Parameters
Type |
Name |
Description |
System.Web.Caching.Cache |
cache |
|
CacheHelper(IRuntimeCacheProvider, ICacheProvider, ICacheProvider)
Declaration
[Obsolete("Use the constructor the specifies all dependencies")]
public CacheHelper(IRuntimeCacheProvider httpCacheProvider, ICacheProvider staticCacheProvider, ICacheProvider requestCacheProvider)
Parameters
CacheHelper(IRuntimeCacheProvider, ICacheProvider, ICacheProvider, IsolatedRuntimeCache)
Initializes a new instance based on the provided providers
Declaration
public CacheHelper(IRuntimeCacheProvider httpCacheProvider, ICacheProvider staticCacheProvider, ICacheProvider requestCacheProvider, IsolatedRuntimeCache isolatedCacheManager)
Parameters
Properties
IsolatedRuntimeCache
Returns the current Isolated Runtime cache manager
Declaration
public IsolatedRuntimeCache IsolatedRuntimeCache { get; }
Property Value
NoCache
Declaration
public static CacheHelper NoCache { get; }
Property Value
RequestCache
Returns the current Request cache
Declaration
public ICacheProvider RequestCache { get; }
Property Value
RuntimeCache
Returns the current Runtime cache
Declaration
public IRuntimeCacheProvider RuntimeCache { get; }
Property Value
StaticCache
Returns the current Runtime cache
Declaration
public ICacheProvider StaticCache { get; }
Property Value
Methods
ClearAllCache()
Clears the item in umbraco's runtime cache
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void ClearAllCache()
ClearCacheByKeyExpression(String)
Clears all cache items that have a key that matches the regular expression
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void ClearCacheByKeyExpression(string regexString)
Parameters
Type |
Name |
Description |
System.String |
regexString |
|
ClearCacheByKeySearch(String)
Clears all cache items that starts with the key passed.
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void ClearCacheByKeySearch(string keyStartsWith)
Parameters
Type |
Name |
Description |
System.String |
keyStartsWith |
The start of the key
|
ClearCacheItem(String)
Clears the item in umbraco's runtime cache with the given key
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void ClearCacheItem(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
Key
|
ClearCacheObjectTypes(String)
Clears all objects in the System.Web.Cache with the System.Type name as the
input parameter. (using [object].GetType())
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void ClearCacheObjectTypes(string typeName)
Parameters
Type |
Name |
Description |
System.String |
typeName |
The name of the System.Type which should be cleared from cache ex "System.Xml.XmlDocument"
|
ClearCacheObjectTypes<T>()
Clears all objects in the System.Web.Cache with the System.Type specified
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void ClearCacheObjectTypes<T>()
Type Parameters
CreateDisabledCacheHelper()
Creates a cache helper with disabled caches
Declaration
public static CacheHelper CreateDisabledCacheHelper()
Returns
GetCacheItem<TT>(String)
Returns a cache item by key, does not update the cache if it isn't there.
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public TT GetCacheItem<TT>(string cacheKey)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
Returns
Type Parameters
GetCacheItem<TT>(String, Func<TT>)
Gets (and adds if necessary) an item from the cache with all of the default parameters
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public TT GetCacheItem<TT>(string cacheKey, Func<TT> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Func<TT> |
getCacheItem |
|
Returns
Type Parameters
GetCacheItem<TT>(String, TimeSpan, Func<TT>)
Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW)
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public TT GetCacheItem<TT>(string cacheKey, TimeSpan timeout, Func<TT> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.TimeSpan |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<TT> |
getCacheItem |
|
Returns
Type Parameters
GetCacheItem<TT>(String, CacheItemPriority, CacheDependency, Func<TT>)
Gets (and adds if necessary) an item from the cache
Declaration
[Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")]
public TT GetCacheItem<TT>(string cacheKey, CacheItemPriority priority, CacheDependency cacheDependency, Func<TT> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.Web.Caching.CacheDependency |
cacheDependency |
|
System.Func<TT> |
getCacheItem |
|
Returns
Type Parameters
GetCacheItem<TT>(String, CacheItemPriority, CacheItemRemovedCallback, TimeSpan, Func<TT>)
Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW)
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public TT GetCacheItem<TT>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan timeout, Func<TT> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.Web.Caching.CacheItemRemovedCallback |
refreshAction |
|
System.TimeSpan |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<TT> |
getCacheItem |
|
Returns
Type Parameters
GetCacheItem<TT>(String, CacheItemPriority, CacheItemRemovedCallback, CacheDependency, TimeSpan, Func<TT>)
Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW)
Declaration
[Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")]
public TT GetCacheItem<TT>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, Func<TT> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.Web.Caching.CacheItemRemovedCallback |
refreshAction |
|
System.Web.Caching.CacheDependency |
cacheDependency |
|
System.TimeSpan |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<TT> |
getCacheItem |
|
Returns
Type Parameters
GetCacheItem<TT>(String, CacheItemRemovedCallback, TimeSpan, Func<TT>)
Gets (and adds if necessary) an item from the cache with the specified absolute expiration date (from NOW)
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public TT GetCacheItem<TT>(string cacheKey, CacheItemRemovedCallback refreshAction, TimeSpan timeout, Func<TT> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemRemovedCallback |
refreshAction |
|
System.TimeSpan |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<TT> |
getCacheItem |
|
Returns
Type Parameters
GetCacheItemsByKeySearch<T>(String)
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public IEnumerable<T> GetCacheItemsByKeySearch<T>(string keyStartsWith)
Parameters
Type |
Name |
Description |
System.String |
keyStartsWith |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
InsertCacheItem<T>(String, CacheItemPriority, Func<T>)
Inserts an item into the cache, if it already exists in the cache it will be replaced
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, Func<T> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.Func<T> |
getCacheItem |
|
Type Parameters
InsertCacheItem<T>(String, CacheItemPriority, TimeSpan, Func<T>)
Inserts an item into the cache, if it already exists in the cache it will be replaced
Declaration
[Obsolete("Do not use this method, access the runtime cache from the RuntimeCache property")]
public void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, TimeSpan timeout, Func<T> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.TimeSpan |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<T> |
getCacheItem |
|
Type Parameters
InsertCacheItem<T>(String, CacheItemPriority, CacheDependency, TimeSpan, Func<T>)
Inserts an item into the cache, if it already exists in the cache it will be replaced
Declaration
[Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")]
public void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheDependency cacheDependency, TimeSpan timeout, Func<T> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.Web.Caching.CacheDependency |
cacheDependency |
|
System.TimeSpan |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<T> |
getCacheItem |
|
Type Parameters
InsertCacheItem<T>(String, CacheItemPriority, CacheItemRemovedCallback, CacheDependency, Nullable<TimeSpan>, Func<T>)
Inserts an item into the cache, if it already exists in the cache it will be replaced
Declaration
[Obsolete("Do not use this method, we no longer support the caching overloads with references to CacheDependency, use the overloads specifying a file collection instead")]
public void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
Parameters
Type |
Name |
Description |
System.String |
cacheKey |
|
System.Web.Caching.CacheItemPriority |
priority |
|
System.Web.Caching.CacheItemRemovedCallback |
refreshAction |
|
System.Web.Caching.CacheDependency |
cacheDependency |
|
System.Nullable<System.TimeSpan> |
timeout |
This will set an absolute expiration from now until the timeout
|
System.Func<T> |
getCacheItem |
|
Type Parameters