import { LogHandlerInterface } from "@pristine-ts/logging"; import { RedisClientInterface } from "../interfaces/redis-client.interface"; import { ClientV3 } from "@camaro/redis"; /** * The client to use to interact with Redis. It is a wrapper around the ClientV3 of library @camaro/redis. * It is tagged so it can be injected using RedisClientInterface. */ export declare class RedisClient implements RedisClientInterface { private readonly host; private readonly port; private readonly namespace; private readonly logHandler; /** * The client from the library @camaro/redis. * @private */ private client?; /** * The client to use to interact with Redis. * @param host The host on which Redis is hosted. * @param port The port at which Redis is hosted. * @param namespace The namespace to use when saving a key in Redis. Our keys are creating using this pattern namespace:table:key. * @param logHandler The log handler to use to output logs. */ constructor(host: string, port: number, namespace: string, logHandler: LogHandlerInterface); /** * Returns the client from ClientV3 library */ getClient(): ClientV3; /** * Sets a key-value entry in Redis * @param table The table name in which to save that entry. We use that to create a key such as namespace:table:key. * @param key The key for the entry * @param value The value of the entry * @param ttl The time to live in seconds */ set(table: string, key: string, value: string, ttl?: number): Promise; /** * Sets a key-list entry in Redis * @param table The table name in which to save that entry. We use that to create a key such as namespace:table:key. * @param key The key for the entry * @param value The array of values of the entry * @param ttl The time to live in seconds */ setList(table: string, key: string, value: string[], ttl?: number): Promise; /** * Gets the value of a key in Redis. * @param table The table name in which to save that entry. We use that to create a key such as namespace:table:key * @param key The key for the entry */ get(table: string, key: string): Promise; /** * Gets the list of a key in Redis * @param table The table name in which to save that entry. We use that to create a key such as namespace:table:key * @param key The key for the entry * @param start The index in the list to start. * @param stop The index in the list to start. -1 means until the end of the list. */ getList(table: string, key: string, start?: number, stop?: number): Promise; /** * Removes an entry in Redis * @param table The table name in which to save that entry. We use that to create a key such as namespace:table:key * @param key The key for the entry */ remove(table: string, key: string): Promise; /** * Clears everything in Redis. */ clearAll(): Promise; /** * Gets the final Redis key such as: namespace:table:key * @param table The table name in which to save that entry. We use that to create a key such as namespace:table:key * @param key The key for the entry */ getKey(table: string, key: string): string; }