UNPKG

node-universe

Version:

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

24 lines (23 loc) 875 B
import { LRUCache } from 'lru-cache'; import BaseCacher from './base'; import Lock from './lock'; import { CacherOptions } from '../../typings/cachers'; import Star from '../star'; export default class MemoryLRUCacher extends BaseCacher { cache: LRUCache<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>; delete(key: string | string[]): Promise<any>; set(key: string, data: any, ttl?: number | undefined): Promise<any>; clean(match?: string | string[]): Promise<any>; checkTTL(): void; getWithTTL(key: string): Promise<any>; lock(key: string, ttl?: number | undefined): Promise<any>; tryLock(key: string, ttl?: number | undefined): Promise<any>; getCacheKeys(): Promise<any>; }