import { RedisService } from '@liaoliaots/nestjs-redis'; import { OnModuleDestroy } from '@nestjs/common'; import { Cache } from 'cache-manager'; import { ICacheChannelHandler, LaqusCacheOptions } from '.'; export interface IChannelPublishResult { numberOfSubscribers: number; } export declare class LayeredCacheProvider implements OnModuleDestroy { private readonly redisService; private readonly memoryCache; private readonly libOptions; private redisClient; private redisPublisher; private redisSubscriber; private channelHandlers; constructor(redisService: RedisService, memoryCache: Cache, libOptions: LaqusCacheOptions); private listenToRedisEvents; private addChannelHandler; getKeysThatStartsWith(startsWith: string): Promise; get(key: string): Promise; set(key: string, data: T): Promise; set(key: string, data: T, ttlSeconds: number): Promise; set(key: string, data: T, ttlSeconds: number, memoryTtlSeconds: number): Promise; flushKeysFromMemoryCache(keys: string[]): Promise; flushKeys(keys: string[]): Promise; delFromMemoryCache(key: string): Promise; del(key: string): Promise; /** * Registra handlers de channels para determinados patterns. Se o pattern já estiver subscrito, ignora */ subscribeToChannels(handlers: ICacheChannelHandler[]): Promise; private initializeSubscriberInstance; private initializeSubscriber; onModuleDestroy(): Promise; /** * Converte a mensagem para JSON e a publica no channel */ publish(channel: string, message: any): Promise; private initializePublisherInstance; /** * Publica uma string no channel */ publishString(channel: string, message: string): Promise; }