@varasto/cache-storage
Version:
Varasto storage implementation that acts as cache for another storage
22 lines (21 loc) • 664 B
TypeScript
import { JsonObject } from 'type-fest';
/**
* Simple map based cache implementation with TTL.
*/
export declare class Cache<T> {
private readonly ttl?;
private readonly storage;
constructor(ttl?: number);
get isEmpty(): boolean;
get(key: string): T | undefined;
set(key: string, value: T): void;
delete(key: string): void;
}
export declare class NamespaceCache {
private readonly ttl?;
private readonly storage;
constructor(ttl?: number);
get(namespace: string, key: string): JsonObject | undefined;
set(namespace: string, key: string, value: JsonObject): void;
delete(namespace: string, key: string): void;
}