UNPKG

@mollitia/redis

Version:
87 lines (86 loc) 2.41 kB
import * as Mollitia from 'mollitia'; export declare const version: string; declare module 'mollitia' { interface ModuleOptions { /** * Redis Circuit helper. [Redis Addon] */ redis?: { /** * Specifies if redis is used for the module. */ use: boolean; /** * Max Delay to wait before timing out requests to get value for a Redis Key within this module. */ getMaxDelay?: number; /** * Global Max Delay to wait before timing out requests to set value for a Redis Key within this module. */ setMaxDelay?: number; /** * Time to Live for Redis keys within this module. */ ttl?: number; }; } } /** * Array containing every modules. */ export declare const modules: Mollitia.Module[]; export interface RedisAddonOptions { /** * The Logger for Redis Addon */ logger?: Mollitia.Logger; /** * Redis Url (Connect using either Redis URL or Redis Host + Redis Port). */ url?: string; /** * Redis Host. */ host?: string; /** * Redis Port. */ port?: number; /** * Username to connect to Redis */ username?: string; /** * Password to connect to Redis */ password?: string; /** * Global TTL (Time To Live) for Redis keys. This could be overridden per module. */ ttl?: number; /** * Global Max Delay to wait before timing out requests to get value for a Redis Key. This could be overridden per module. */ getMaxDelay?: number; /** * Global Max Delay to wait before timing out requests to set value for a Redis Key. This could be overridden per module. */ setMaxDelay?: number; } /** * The RedisAddon Class, that should be added to the core Mollitia module. [Redis Addon] * @example * Mollitia.use(new MollitiaRedis.RedisAddon()); */ export declare class RedisAddon implements Mollitia.Addon { private redis?; private getMaxDelay; private setMaxDelay; private ttl; private logger?; constructor(options: RedisAddonOptions); private getStateWithRedis; private setStateWithRedis; private moduleOverride; onModuleCreate(module: Mollitia.Module, options: Mollitia.ModuleOptions): void; }