| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- // 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:',
- };
|