首页增加短剧推荐

This commit is contained in:
mtvpls
2025-12-18 21:36:31 +08:00
parent 6f780d66fe
commit 0ae5923b4b
12 changed files with 497 additions and 1 deletions
+22
View File
@@ -495,4 +495,26 @@ export abstract class BaseRedisStorage implements IStorage {
throw new Error('清空数据失败');
}
}
// ---------- 通用键值存储 ----------
private globalValueKey(key: string) {
return `global:${key}`;
}
async getGlobalValue(key: string): Promise<string | null> {
const val = await this.withRetry(() =>
this.client.get(this.globalValueKey(key))
);
return val ? ensureString(val) : null;
}
async setGlobalValue(key: string, value: string): Promise<void> {
await this.withRetry(() =>
this.client.set(this.globalValueKey(key), ensureString(value))
);
}
async deleteGlobalValue(key: string): Promise<void> {
await this.withRetry(() => this.client.del(this.globalValueKey(key)));
}
}