LRUCache<T>( options?: CacheOptions<T>,): { delete: (key: unknown) => void; get: (key: unknown) => undefined | T; has: (key: unknown) => boolean; refresh: () => void; set: (key: unknown, value: T, ttlOverride?: number) => void;} Parameters
- options: CacheOptions<T> = {}
Returns {
delete: (key: unknown) => void;
get: (key: unknown) => undefined | T;
has: (key: unknown) => boolean;
refresh: () => void;
set: (key: unknown, value: T, ttlOverride?: number) => void;
}
The cache object.
Creates a Least Recently Used (LRU) cache.
The returned object has the following methods:
delete: Deletes an item from the cache.get: Returns the value of an item in the cache.has: Returns whether an item is in the cache.set: Sets an item in the cache.refresh: Deletes all items from the cache.Example