Revert "Don't cache empty arrays"

This reverts commit 9ab939456b.
This commit is contained in:
Ajay
2022-07-20 00:23:02 -04:00
parent f2904da653
commit 288f7d45e7
2 changed files with 5 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ import { skipSegmentsHashKey, skipSegmentsKey, reputationKey, ratingHashKey, ski
import { Service, VideoID, VideoIDHash } from "../types/segments.model";
import { Feature, HashedUserID, UserID } from "../types/user.model";
async function get<T>(fetchFromDB: () => Promise<T>, key: string, cacheEmpty = true): Promise<T> {
async function get<T>(fetchFromDB: () => Promise<T>, key: string): Promise<T> {
try {
const reply = await redis.get(key);
if (reply) {
@@ -16,9 +16,7 @@ async function get<T>(fetchFromDB: () => Promise<T>, key: string, cacheEmpty = t
const data = await fetchFromDB();
if (cacheEmpty || data) {
redis.set(key, JSON.stringify(data)).catch((err) => Logger.error(err));
}
redis.set(key, JSON.stringify(data)).catch((err) => Logger.error(err));
return data;
}