|
@@ -5,25 +5,52 @@
|
|
|
* Actual keys in Redis will be: <REDIS_KEY_PREFIX><logicalKey>
|
|
* Actual keys in Redis will be: <REDIS_KEY_PREFIX><logicalKey>
|
|
|
* e.g. "box:" + "app:channel:all" => "box:app:channel:all"
|
|
* e.g. "box:" + "app:channel:all" => "box:app:channel:all"
|
|
|
*/
|
|
*/
|
|
|
|
|
+
|
|
|
export const CacheKeys = {
|
|
export const CacheKeys = {
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
// CHANNELS
|
|
// CHANNELS
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
- appChannelAll: 'app:channel:all',
|
|
|
|
|
- appChannelById: (channelId: string | number): string =>
|
|
|
|
|
- `app:channel:by-id:${channelId}`,
|
|
|
|
|
|
|
+ channel: {
|
|
|
|
|
+ // keep for backward compatibility (even if not used now)
|
|
|
|
|
+ all: 'app:channel:all',
|
|
|
|
|
+
|
|
|
|
|
+ byId: (channelId: string | number): string =>
|
|
|
|
|
+ `app:channel:by-id:${channelId}`,
|
|
|
|
|
+
|
|
|
|
|
+ // NEW: channel with categories tree
|
|
|
|
|
+ withCategories: (channelId: string | number): string =>
|
|
|
|
|
+ `app:channel:with-categories:${channelId}`,
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
// CATEGORIES
|
|
// CATEGORIES
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
- appCategoryAll: 'app:category:all',
|
|
|
|
|
- appCategoryById: (categoryId: string | number): string =>
|
|
|
|
|
- `app:category:by-id:${categoryId}`,
|
|
|
|
|
|
|
+ category: {
|
|
|
|
|
+ // keep for backward compatibility
|
|
|
|
|
+ all: 'app:category:all',
|
|
|
|
|
+
|
|
|
|
|
+ byId: (categoryId: string | number): string =>
|
|
|
|
|
+ `app:category:by-id:${categoryId}`,
|
|
|
|
|
+
|
|
|
|
|
+ // NEW: category with tags tree
|
|
|
|
|
+ withTags: (categoryId: string | number): string =>
|
|
|
|
|
+ `app:category:with-tags:${categoryId}`,
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // ─────────────────────────────────────────────
|
|
|
|
|
+ // TAGS
|
|
|
|
|
+ // ─────────────────────────────────────────────
|
|
|
|
|
+ tag: {
|
|
|
|
|
+ // NEW: tag:all for search suggestions
|
|
|
|
|
+ all: 'app:tag:all',
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
// ADS
|
|
// ADS
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
- appAdById: (adId: string | number): string => `app:ad:by-id:${adId}`,
|
|
|
|
|
|
|
+ ad: {
|
|
|
|
|
+ byId: (adId: string | number): string => `app:ad:by-id:${adId}`,
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
// AD POOLS
|
|
// AD POOLS
|
|
@@ -31,17 +58,21 @@ export const CacheKeys = {
|
|
|
// slot: e.g. "top", "carousel", "popup"
|
|
// slot: e.g. "top", "carousel", "popup"
|
|
|
// type: e.g. "BANNER", "CAROUSEL", "POPUP"
|
|
// type: e.g. "BANNER", "CAROUSEL", "POPUP"
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
- appAdPool: (scene: string, slot: string, type: string): string =>
|
|
|
|
|
- `app:adpool:${scene}:${slot}:${type}`,
|
|
|
|
|
|
|
+ adPool: {
|
|
|
|
|
+ pool: (scene: string, slot: string, type: string): string =>
|
|
|
|
|
+ `app:adpool:${scene}:${slot}:${type}`,
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
// VIDEO LISTS
|
|
// VIDEO LISTS
|
|
|
// ─────────────────────────────────────────────
|
|
// ─────────────────────────────────────────────
|
|
|
- appHomeVideoPage: (page: number): string => `app:videolist:home:page:${page}`,
|
|
|
|
|
|
|
+ videoList: {
|
|
|
|
|
+ homePage: (page: number): string => `app:videolist:home:page:${page}`,
|
|
|
|
|
|
|
|
- appChannelVideoPage: (channelId: string | number, page: number): string =>
|
|
|
|
|
- `app:videolist:channel:${channelId}:page:${page}`,
|
|
|
|
|
|
|
+ byChannelPage: (channelId: string | number, page: number): string =>
|
|
|
|
|
+ `app:videolist:channel:${channelId}:page:${page}`,
|
|
|
|
|
|
|
|
- appTrendingVideoPage: (countryCode: string, page: number): string =>
|
|
|
|
|
- `app:videolist:trending:${countryCode}:page:${page}`,
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ trendingPage: (countryCode: string, page: number): string =>
|
|
|
|
|
+ `app:videolist:trending:${countryCode}:page:${page}`,
|
|
|
|
|
+ },
|
|
|
|
|
+} as const;
|