@kotori-bot/core
Version:
Kotori Core
38 lines (37 loc) • 897 B
TypeScript
import { Service, type Context } from '../app';
type CacheKey = string | symbol | number;
type CacheValue = string | number | object;
type Container = Map<CacheKey, CacheValue>;
/**
* Cache service
*
* @class
* @extends Service
*/
export declare class Cache extends Service {
private cache?;
constructor(ctx: Context);
start(): void;
stop(): void;
/**
* Get the container of current content instance.
*
* @returns THe container
*/
getContainer(): Container;
/**
* Get the value from current the container.
*
* @param prop The property name
* @returns The value
*/
get<T = CacheValue>(prop: CacheKey): T;
/**
* Set the value to current the container.
*
* @param prop The property name
* @param value The value
*/
set(prop: CacheKey, value: CacheValue): void;
}
export default Cache;