Class FastDictionaryAppCacheBase
Provides a base class to fast, dictionary-based IAppCache implementations.
Inheritance
Namespace: Umbraco.Cms.Core.Cache
Assembly: Umbraco.Core.dll
Syntax
public abstract class FastDictionaryAppCacheBase : IAppCache
Fields
View SourceCacheItemPrefix
Declaration
protected const string CacheItemPrefix = "umbrtmche"
Field Value
Type | Description |
---|---|
System.String |
Methods
View SourceClear()
Removes all items from the cache.
Declaration
public virtual void Clear()
Clear(String)
Removes an item identified by its key from the cache.
Declaration
public virtual void Clear(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the item. |
ClearByKey(String)
Clears items with a key starting with the specified value.
Declaration
public virtual void ClearByKey(string keyStartsWith)
Parameters
Type | Name | Description |
---|---|---|
System.String | keyStartsWith | The StartsWith value to use in the search. |
ClearByRegex(String)
Clears items with a key matching a regular expression.
Declaration
public virtual void ClearByRegex(string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | regex | The regular expression. |
ClearOfType(Nullable<Type>)
Declaration
public virtual void ClearOfType(Type? type)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<Type> | type |
ClearOfType<T>()
Removes items of a specified type from the cache.
Declaration
public virtual void ClearOfType<T>()
Type Parameters
Name | Description |
---|---|
T | The type of the items to remove. |
Remarks
If the type is an interface, then all items of a type implementing that interface are removed. Otherwise, only items of that exact type are removed (items of type inheriting from the specified type are not removed).
ClearOfType<T>(Func<String, T, Boolean>)
Removes items of a specified type from the cache.
Declaration
public virtual void ClearOfType<T>(Func<string, T, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<System.String, T, System.Boolean> | predicate | The predicate to satisfy. |
Type Parameters
Name | Description |
---|---|
T | The type of the items to remove. |
Remarks
If the type is an interface, then all items of a type implementing that interface are removed. Otherwise, only items of that exact type are removed (items of type inheriting from the specified type are not removed).
EnterReadLock()
Declaration
protected abstract void EnterReadLock()
EnterWriteLock()
Declaration
protected abstract void EnterWriteLock()
ExitReadLock()
Declaration
protected abstract void ExitReadLock()
ExitWriteLock()
Declaration
protected abstract void ExitWriteLock()
Get(String)
Gets an item identified by its key.
Declaration
public virtual object Get(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the item. |
Returns
Type | Description |
---|---|
System.Object | The item, or null if the item was not found. |
Get(String, Func<Object>)
Gets or creates an item identified by its key.
Declaration
public abstract object Get(string key, Func<object> factory)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the item. |
Func<System.Object> | factory | A factory function that can create the item. |
Returns
Type | Description |
---|---|
System.Object | The item. |
GetCacheKey(String)
Declaration
protected string GetCacheKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.String |
GetDictionaryEntries()
Declaration
protected abstract IEnumerable<KeyValuePair<object, object>> GetDictionaryEntries()
Returns
Type | Description |
---|---|
IEnumerable<KeyValuePair<System.Object, System.Object>> |
GetEntry(String)
Declaration
protected abstract object GetEntry(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.Object |
RemoveEntry(String)
Declaration
protected abstract void RemoveEntry(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
SearchByKey(String)
Gets items with a key starting with the specified value.
Declaration
public virtual IEnumerable<object> SearchByKey(string keyStartsWith)
Parameters
Type | Name | Description |
---|---|---|
System.String | keyStartsWith | The StartsWith value to use in the search. |
Returns
Type | Description |
---|---|
IEnumerable<System.Object> | Items matching the search. |
SearchByRegex(String)
Gets items with a key matching a regular expression.
Declaration
public virtual IEnumerable<object> SearchByRegex(string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | regex | The regular expression. |
Returns
Type | Description |
---|---|
IEnumerable<System.Object> | Items matching the search. |