lesgo
Version:
Core framework for lesgo node.js serverless framework.
31 lines (30 loc) • 1.05 kB
TypeScript
import { ClientOptions } from '../../../types/aws';
/**
* Retrieves a Redis client.
*
* This function will return a Redis client that is connected to the ElastiCache Redis cluster.
* A new client will be created if one does not already exist. The client will be reused if it is already connected.
* This is useful if you need to use the Redis Client functions directly.
*
* This function is not intended to be used directly.
* Use the available `getCache`, `setCache`, and `deleteCache` functions instead.
*
* @param {ClientOptions} clientOpts - Optional client options.
* @returns A promise of with Redis client.
*
* @throws {LesgoException} If there is an error creating the client.
*
* @example
* ```typescript
* import { getClient } from 'lesgo/utils/cache/redis';
*
* const client = await getClient();
*
* const key = 'myKey';
* const value = 'myValue';
*
* await client.set(key, value);
* ```
*/
declare const getClient: (clientOpts?: ClientOptions) => Promise<import("ioredis").Cluster>;
export default getClient;