Skip to main content

CacheConfig

CacheConfig

Configuration for a new Cache instance.

Signature
interface CacheConfig {
getKey: (id: string | number) => string;
options?: SetCacheKeyOptions;
}

getKey

property
(id: string | number) => string

A function which generates a cache key from the given id. This key will be used to store the value in the cache.

By convention, the key should be namespaced to avoid conflicts.

Example

getKey: id => `MyStrategy:getProductVariantIds:${id}`,

options

property
SetCacheKeyOptions

Options available when setting the value in the cache.