Add client-side caching

This commit is contained in:
Ajay
2024-02-05 13:11:44 -05:00
parent 547632341a
commit 14da10bd8a
6 changed files with 81 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ import { Feature, HashedUserID, UserID } from "../types/user.model";
import { HashedValue } from "../types/hash.model";
import { Logger } from "./logger";
import { BrandingUUID } from "../types/branding.model";
import { RedisCommandArgument } from "@redis/client/dist/lib/commands";
export const skipSegmentsKey = (videoID: VideoID, service: Service): string =>
`segments.v6.${service}.videoID.${videoID}`;
@@ -65,4 +66,8 @@ export function videoLabelsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Se
export function userFeatureKey (userID: HashedUserID, feature: Feature): string {
return `user.v2.${userID}.feature.${feature}`;
}
export function shouldClientCacheKey(key: RedisCommandArgument): boolean {
return (key as string).startsWith("segments.");
}