dino-core
Version:
A dependency injection framework for NodeJS applications
23 lines (22 loc) • 782 B
TypeScript
import LRUCache from 'lru-cache';
export interface CacheOptions {
max: number;
maxAge: number;
updateAgeOnGet: boolean;
}
export declare class CacheManager {
private readonly caches;
constructor();
store(cacheName: string, key: string, value: any, opts?: CacheOptions): CacheManager;
get(cacheName: string, key: string, opts?: CacheOptions): any;
has(cacheName: string, key: string): boolean;
evict(cacheName: string, key: string): CacheManager;
clear(cacheName: string): CacheManager;
protected create(cacheName: string, opts: CacheOptions): LRUCache;
/**
*
* @param cacheName the cache name
* @returns an instance of lru-cache
*/
protected getCacheByName(cacheName: string, opts?: CacheOptions): LRUCache;
}