// libs/common/src/cache/cache-keys.ts import type { AdType } from '../ads/ad-types'; /** * Video sort key type for video listing and pooling. */ export type VideoSortKey = 'latest' | 'popular' | 'manual'; /** * Video home section key type for home page sections. */ export type VideoHomeSectionKey = 'featured' | 'latest' | 'editorPick'; export const CacheKeys = { // ───────────────────────────────────────────── // CHANNELS // ───────────────────────────────────────────── appChannelAll: 'box:app:channel:all', appChannelById: (channelId: string | number): string => `box:app:channel:by-id:${channelId}`, appChannelWithCategories: (channelId: string | number): string => `box:app:channel:with-categories:${channelId}`, // ───────────────────────────────────────────── // CATEGORIES // ───────────────────────────────────────────── appCategory: (categoryId: string | number): string => `box:app:category:${categoryId}`, appCategoryAll: 'box:app:category:all', appCategoryById: (categoryId: string | number): string => `box:app:category:by-id:${categoryId}`, appCategoryWithTags: (categoryId: string | number): string => `box:app:category:with-tags:${categoryId}`, // ───────────────────────────────────────────── // TAGS // ───────────────────────────────────────────── appTagAll: 'box:app:tag:all', appTagByCategoryKey: (categoryId: string | number): string => `box:app:tag:list:${categoryId}`, // ───────────────────────────────────────────── // ADS // ───────────────────────────────────────────── // ───────────────────────────────────────────── // AD POOLS (AdType-based) // ───────────────────────────────────────────── appAdPoolByType: (adType: AdType | string): string => `box:app:adpool:${adType}`, // ───────────────────────────────────────────── // VIDEO LISTS // ───────────────────────────────────────────── appHomeVideoPage: (page: number): string => `box:app:videolist:home:page:${page}`, appChannelVideoPage: (channelId: string | number, page: number): string => `box:app:videolist:channel:${channelId}:page:${page}`, // ───────────────────────────────────────────── // VIDEO DETAILS & METADATA // ───────────────────────────────────────────── appVideoDetailKey: (videoId: string): string => `box:app:video:detail:${videoId}`, appVideoPayloadKey: (videoId: string): string => `box:app:video:payload:${videoId}`, appVideoCategoryListKey: (categoryId: string): string => `box:app:video:category:list:${categoryId}`, appVideoTagListKey: (categoryId: string, tagId: string): string => `box:app:video:tag:list:${categoryId}:${tagId}`, // ───────────────────────────────────────────── // VIDEO POOLS // ───────────────────────────────────────────── appVideoCategoryPoolKey: ( channelId: string, categoryId: string, sort: VideoSortKey, ): string => `box:app:video:list:category:${channelId}:${categoryId}:${sort}`, appVideoTagPoolKey: ( channelId: string, tagId: string, sort: VideoSortKey, ): string => `box:app:video:list:tag:${channelId}:${tagId}:${sort}`, appVideoHomeSectionKey: ( channelId: string, section: string, ): string => `box:app:video:list:home:${channelId}:${section}`, // ───────────────────────────────────────────── // RECOMMENDED VIDEOS // ───────────────────────────────────────────── appRecommendedVideos: 'box:app:video:recommended', appVideoLatest: 'box:app:video:latest', appVideoList: 'box:app:video:list', appGuessList: 'box:app:video:guess:', };