mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 11:36:58 +03:00
Allow video labels cashing with prefix of 4
This commit is contained in:
@@ -81,7 +81,7 @@ async function getSegmentsFromDBByHash(hashedVideoIDPrefix: VideoIDHash, service
|
|||||||
[`${hashedVideoIDPrefix}%`, service]
|
[`${hashedVideoIDPrefix}%`, service]
|
||||||
) as Promise<DBSegment[]>;
|
) as Promise<DBSegment[]>;
|
||||||
|
|
||||||
if (hashedVideoIDPrefix.length === 3) {
|
if (hashedVideoIDPrefix.length === 3 || hashedVideoIDPrefix.length === 4) {
|
||||||
return await QueryCacher.get(fetchFromDB, videoLabelsHashKey(hashedVideoIDPrefix, service));
|
return await QueryCacher.get(fetchFromDB, videoLabelsHashKey(hashedVideoIDPrefix, service));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,9 @@ export const videoLabelsKey = (videoID: VideoID, service: Service): string =>
|
|||||||
`labels.v2.${service}.videoID.${videoID}`;
|
`labels.v2.${service}.videoID.${videoID}`;
|
||||||
|
|
||||||
export function videoLabelsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string {
|
export function videoLabelsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string {
|
||||||
hashedVideoIDPrefix = hashedVideoIDPrefix.substring(0, 3) as VideoIDHash;
|
const length = hashedVideoIDPrefix.length;
|
||||||
if (hashedVideoIDPrefix.length !== 3) Logger.warn(`Redis video labels hash-prefix key is not length 3! ${hashedVideoIDPrefix}`);
|
|
||||||
|
|
||||||
return `labels.v1.${service}.${hashedVideoIDPrefix}`;
|
return `labels.v1.${length}.${service}.${hashedVideoIDPrefix}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function userFeatureKey (userID: HashedUserID, feature: Feature): string {
|
export function userFeatureKey (userID: HashedUserID, feature: Feature): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user