import { Injectable } from '@nestjs/common'; import { BaseCacheService } from '@box/common/cache/cache-service'; import { tsCacheKeys } from '@box/common/cache/ts-cache-key.provider'; import { ChannelCachePayload } from './channel-cache.builder'; import { RedisService } from '@box/db/redis/redis.service'; @Injectable() export class ChannelCacheService extends BaseCacheService { constructor(redis: RedisService) { super(redis, ChannelCacheService.name); } async getAllChannels(): Promise { return ( (await this.getJson(tsCacheKeys.channel.all())) ?? [] ); } // async getChannelById(id: string): Promise { // if (!id) return null; // return ( // (await this.getJson(tsCacheKeys.channel.byId(id))) ?? // null // ); // } async getChannelById(channelId: string): Promise { if (!channelId) return null; return ( (await this.getJson( tsCacheKeys.channel.byId(channelId), )) ?? null ); } }