• IMemoryCache

Contents

IMemoryCache

Namespace: SharedPluginFeatures

Assembly: SharedPluginFeatures

MemoryCachePlugin implements an instance of IMemoryCache, and add the instance to the DI container. Plugins and other modules can obtain an instance of IMemoryCache which can be used to store and retrieve items easily from a designated cache.

Methods

GetShortCache() The short cache is inteded to hold items for upto 5 minutes, after which items will expire. This can be useful for storing short term items like price information etc, that could change regularly. There is no limit to the items that can be cached and cache retrieval is extremely quick.
GetCache() The long cache is inteded to hold items for upto 2 hours, after which items will expire. This can be useful for storing medium term items like product information etc, that doesn't change too regularly but will help speed up requests when retrieving. There is no limit to the items that can be cached and cache retrieval is extremely quick.
GetExtendingCache() The extending cache is intended to cache items for 2 hours, after which items will expire. The difference between the extending cache and normal cache is that if an item is requested the time until expire will be extended by a further 2 hours. There is no limit to the items that can be cached and cache retrieval is extremely quick.
GetPermanentCache() The permanent cache holds items in memory indefinitely. There is no limit to the items that can be cached and cache retrieval is extremely quick.
ResetCaches() Resets all caches, clears all items.

In This Document