Cache
A convenience wrapper around the CacheService methods which provides a simple API for caching and retrieving data.
The advantage of using the Cache class rather than directly calling the CacheService
methods is that it allows you to define a consistent way of generating cache keys and
to set default cache options, and takes care of setting the value in cache if it does not
already exist.
In most cases, using the Cache class will result in simpler and more readable code.
This class is normally created via the CacheService.createCache() method.
Example
constructor
(config: CacheConfig, cacheService: CacheService) => Cacheget
(id: string | number, getValueFn: () => T | Promise<T>) => Promise<T>Retrieves the value from the cache if it exists, otherwise calls the getValueFn function
to get the value, sets it in the cache and returns it.
delete
(id: string | number | Array<string | number>) => Promise<void>Deletes one or more items from the cache.
invalidateTags
(tags: string[]) => Promise<void>Invalidates one or more tags in the cache.