@citrineos/util
Version:
The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.
20 lines (19 loc) • 962 B
TypeScript
import { ICache } from '@citrineos/base';
import { ClassConstructor } from 'class-transformer';
/**
* Implementation of cache interface with memory storage
*/
export declare class MemoryCache implements ICache {
private _cache;
private _keySubscriptionMap;
private _keySubscriptionPromiseMap;
private _timeoutMap;
constructor();
exists(key: string, namespace?: string): Promise<boolean>;
remove(key: string, namespace?: string): Promise<boolean>;
onChange<T>(key: string, waitSeconds: number, namespace?: string, classConstructor?: () => ClassConstructor<T>): Promise<T | null>;
get<T>(key: string, namespace?: string, classConstructor?: () => ClassConstructor<T>): Promise<T | null>;
set(key: string, value: string, namespace?: string, expireSeconds?: number): Promise<boolean>;
setIfNotExist(key: string, value: string, namespace?: string, expireSeconds?: number): Promise<boolean>;
private resolveOnChange;
}