UNPKG

@takentrade/takentrade-libs

Version:
26 lines (25 loc) 1.12 kB
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common'; import Redis from 'ioredis'; import type { CacheOptions } from './cache.interface'; export declare class CacheService implements OnModuleInit, OnModuleDestroy { private readonly options; private redisClient; constructor(options: CacheOptions); onModuleInit(): Promise<void>; onModuleDestroy(): Promise<void>; getClient(): Redis; set(key: string, value: string, ttlSeconds?: number): Promise<void>; get(key: string): Promise<string | null>; del(key: string): Promise<void>; exists(key: string): Promise<boolean>; ttl(key: string): Promise<number>; keys(pattern: string): Promise<string[]>; flushAll(): Promise<void>; incr(key: string): Promise<number>; decr(key: string): Promise<number>; hset(key: string, field: string, value: string): Promise<void>; hget(key: string, field: string): Promise<string | null>; hgetall(key: string): Promise<Record<string, string>>; hdel(key: string, field: string): Promise<void>; expire(key: string, ttlSeconds: number): Promise<void>; }