Stores an object of type T in the cache under the specified key.
The key and category are automatically scoped by domain and language.
Namespace:
AdvantageCMS.Core.Utils.Cache
Assembly:
AdvantageCMS.Core (in AdvantageCMS.Core.dll)
public void Store<T>(
string key,
T item,
string category,
int expiryMinutes
)
Type Parameters
- T
- The type of the object to cache. Must be a reference type.
Parameters
- key
- Type: String
The cache key prefix under which the item is stored.
- item
- Type: T
The object to store in the cache.
- category
- Type: String
The category used for grouping cached items (for bulk invalidation).
- expiryMinutes
- Type: Int32
The number of minutes before the cached item expires.
Store a list of recently published articles in the cache for 15 minutes.
C#
var cache = new AdvantageCacheManager(eAdvantageCacheContainerType.WebServer, 1, 1);
List<Article> articles = GetRecentArticles();
cache.Store<List<Article>>("recent_articles", articles, "articles", 15);