@lakutata-component/cacher
Version:
Lakutata Cacher Component
24 lines (23 loc) • 1.16 kB
TypeScript
import { Application, Component } from '@lakutata/core';
import { Cache } from 'cache-manager';
import { TCacheOptions } from './types/TCacheOptions';
export { IRedisCacheOptions } from './interfaces/IRedisCacheOptions';
export { IMemcachedCacheOptions } from './interfaces/IMemcachedCacheOptions';
export { IBaseCacheOptions } from './interfaces/IBaseCacheOptions';
export { IMemoryCacheOptions } from './interfaces/IMemoryCacheOptions';
export { IFileSystemCacheOptions } from './interfaces/IFileSystemCacheOptions';
export { TCacheOptions as CacheOptions } from './types/TCacheOptions';
export declare class CacherComponent extends Component {
protected readonly app: Application;
protected readonly prefix: string;
protected readonly options?: TCacheOptions;
protected ttl: number;
protected cache: Cache;
protected initialize(): Promise<void>;
protected generateCacheKey(key: string): string;
set(key: string, value: any): Promise<boolean>;
get<T = any>(key: string): Promise<T | null>;
getOrSet<T = any>(key: string, value: T): Promise<T>;
del(key: string): Promise<boolean>;
reset(): Promise<void>;
}