cachly
Version:
Type-safe, production-ready in-memory cache system for Node.js and TypeScript with advanced features.
27 lines • 1.54 kB
TypeScript
import { Cachly } from './Cachly';
import { CacheOptions } from './types';
export interface CacheDecoratorOptions extends Partial<CacheOptions> {
key?: string | ((args: any[]) => string);
ttl?: number;
tags?: string[];
dependsOn?: string[];
}
export declare class CacheDecorators {
private static defaultCache;
static setDefaultCache(cache: Cachly): void;
static cache(options?: CacheDecoratorOptions): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
static invalidate(options: {
tags?: string[];
keys?: string[];
pattern?: string;
}): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
static cacheMethod(key: string, ttl?: number): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
static cacheWithTags(tags: string[], ttl?: number): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
static invalidateTags(tags: string[]): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
}
export declare const cache: typeof CacheDecorators.cache;
export declare const invalidate: typeof CacheDecorators.invalidate;
export declare const cacheMethod: typeof CacheDecorators.cacheMethod;
export declare const cacheWithTags: typeof CacheDecorators.cacheWithTags;
export declare const invalidateTags: typeof CacheDecorators.invalidateTags;
//# sourceMappingURL=decorators.d.ts.map