Class FastDictionaryAppCache
Implements a fast IAppCache on top of a concurrent dictionary.
Inheritance
Namespace: Umbraco.Cms.Core.Cache
Assembly: Umbraco.Core.dll
Syntax
public class FastDictionaryAppCache : IAppCache
Properties
View SourceCount
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Keys
Declaration
public IEnumerable<string> Keys { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<System.String> |
Methods
View SourceClear()
Removes all items from the cache.
Declaration
public void Clear()
Clear(String)
Removes an item identified by its key from the cache.
Declaration
public 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 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 void ClearByRegex(string regex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | regex | The regular expression. |
ClearOfType(Nullable<Type>)
Declaration
public 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 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 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).
Get(String)
Gets an item identified by its key.
Declaration
public object Get(string cacheKey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | cacheKey |
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 object Get(string cacheKey, Func<object> getCacheItem)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | cacheKey | |
| Func<System.Object> | getCacheItem |
Returns
| Type | Description |
|---|---|
| System.Object | The item. |
Remarks
Null values returned from the factory function are never cached.
SearchByKey(String)
Gets items with a key starting with the specified value.
Declaration
public 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 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. |