@citrineos/util
Version:
The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.
22 lines (21 loc) • 1.24 kB
TypeScript
import type { ICache } from '@citrineos/base';
import type { ClassConstructor } from 'class-transformer';
import type { RedisClientOptions } from 'redis';
import type { ILogObj } from 'tslog';
import { Logger } from 'tslog';
/**
* Implementation of cache interface with redis storage
*/
export declare class RedisCache implements ICache {
private _client;
private _logger;
constructor(clientOptions?: RedisClientOptions, logger?: Logger<ILogObj>);
exists(key: string, namespace?: string): Promise<boolean>;
existsAnyInNamespace(namespace: string): Promise<boolean>;
remove(key: string, namespace?: string | undefined): Promise<boolean>;
onChange<T>(key: string, waitSeconds: number, namespace?: string | undefined, classConstructor?: (() => ClassConstructor<T>) | undefined): 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>;
updateExpiration(key: string, expireSeconds: number, namespace?: string): Promise<boolean>;
}