Class CacheProvider
Base class for cache implementations for Dynamic Data Store
Namespace: EPiServer.Data.Cache
Assembly: EPiServer.Data.dll
Version: 9.12.2Syntax
public abstract class CacheProvider : ProviderBase
Constructors
CacheProvider()
Declaration
protected CacheProvider()
Properties
ExternalCacheHandler
Gets the cache notifier used by concrete cache provider.
Declaration
protected abstract IExternalCacheHandler ExternalCacheHandler { get; }
Property Value
Type | Description |
---|---|
IExternalCacheHandler | The cache notifier. |
Instance
Singleton access to the cache provider
Declaration
public static CacheProvider Instance { get; set; }
Property Value
Type | Description |
---|---|
CacheProvider | The instance. |
Methods
Add(String, PropertyBag, String, IDictionary<Identity, Object>, String[])
Adds an item to cache with an optional list of dependencies.
Declaration
public void Add(string key, PropertyBag propertyBag, string storeName, IDictionary<Identity, object> loadedObjectsInContext, params string[] dependencyKeys)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to the item to be cached |
PropertyBag | propertyBag | The object to cache as a PropertyBag |
System.String | storeName | Name of the store. |
System.Collections.Generic.IDictionary<Identity, System.Object> | loadedObjectsInContext | The loaded objects in context. |
System.String[] | dependencyKeys | The keys to the items that this item has a dependency to |
Add(String, Object, String, String[])
Adds an item to cache with an optional list of dependencies.
Declaration
public void Add(string key, object value, string storeName, params string[] dependencyKeys)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to the item to be cached |
System.Object | value | The item to cache |
System.String | storeName | The name of the store to associate this item with |
System.String[] | dependencyKeys | The keys to the items that this item has a dependency to |
Clear()
Clears the whole cache
Declaration
public void Clear()
ClearAllCore()
Clears the whole cache provided by concrete cache provider.
Declaration
protected abstract void ClearAllCore()
ClearStore(String)
Clears the cache for items associated with a specific store
Declaration
public virtual void ClearStore(string storeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName |
ClearStoreCore(String)
Clears all items associated with given storeName.
Declaration
protected abstract void ClearStoreCore(string storeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
Get(String)
Gets a cached item given its unique key
Declaration
public object Get(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to the cached item |
Returns
Type | Description |
---|---|
System.Object | The cached item |
Get(String, Type)
Gets a cached item from cache with specific key and type
Declaration
public object Get(string key, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key associated with the item |
System.Type | type | The requested |
Returns
Type | Description |
---|---|
System.Object | An cached item if exist in cache otherwise null |
Get<T>(String)
Gets a typed object from cache
Declaration
public T Get<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
Returns
Type | Description |
---|---|
T | An cached item if exist in cache otherwise null |
Type Parameters
Name | Description |
---|---|
T |
GetCore(String)
Gets a cached item from concrete cache provider
Declaration
protected abstract CacheItem GetCore(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the item to get |
Returns
Type | Description |
---|---|
CacheItem | The cached item or null if not exist in cache |
Initialize(String, NameValueCollection)
Initializes the provider.
Declaration
public override void Initialize(string name, NameValueCollection config)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The friendly name of the provider. |
System.Collections.Specialized.NameValueCollection | config | A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The name of the provider is null. |
System.ArgumentException | The name of the provider has a length of zero. |
System.InvalidOperationException | An attempt is made to call System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection) on a provider after the provider has already been initialized. |
InsertCore(String, CacheItem)
Inserts a item in the cache provided by concrete cache provider.
Declaration
protected abstract void InsertCore(string key, CacheItem value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to the cached item |
CacheItem | value | The item to cache |
Remove(String)
Removes a cached item associated with given unique key
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to the cached item |
RemoveCore(String)
Removes a cached item in the cache provided by concrete cache provider.
Declaration
protected abstract void RemoveCore(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to the cached item |
Uninitialize()
Un-initialize the provider.
Declaration
public virtual void Uninitialize()
Remarks
Will undo all initializations made by the Initialize method.