UNPKG

node-universe

Version:

基于 Nodejs 环境的一款微服务框架,原理来自于宇宙中的恒星,行星,卫星等系统。

24 lines (23 loc) 921 B
import { CacherOptions } from '../../typings/cachers'; import BaseCacher from './base'; import Lock from './lock'; import Star from '../star'; import { GenericObject } from '../../typings'; export default class MemoryCacher extends BaseCacher { cache: Map<string, any>; _lock: Lock; timer: any; clone: (value: any) => any; constructor(options: CacherOptions); init(star: Star): void; close(): Promise<any>; get(key: string): Promise<any>; set(key: string, data: any, ttl?: number | undefined): Promise<any>; delete(key: string | string[]): Promise<any>; clean(match?: string | string[] | undefined): Promise<any>; private checkTTL; getWithTTL(key: string): Promise<any>; lock(key: string, ttl?: number | undefined): Promise<() => Promise<void>>; tryLock(key: string, ttl?: number | undefined): Promise<any>; getCacheKeys(): Promise<Array<GenericObject>>; }