@mojojs/core
Version:
Real-time web framework
24 lines (23 loc) • 442 B
TypeScript
/**
* Cache class.
*/
export declare class Cache<T> {
/**
* Maximum number of values in cache, defaults to `100`.
*/
max: number;
_cache: Record<string, T>;
_queue: string[];
/**
* Get cached value.
*/
get(key: string): T | undefined;
/**
* Add value to the cache.
*/
set(key: string, value: T): void;
/**
* Current size of the cache.
*/
get size(): number;
}