首页增加短剧推荐

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
@@ -393,6 +393,28 @@ export class UpstashRedisStorage implements IStorage {
throw new Error('清空数据失败');
}
}
// ---------- 通用键值存储 ----------
private globalValueKey(key: string) {
return `global:${key}`;
}
async getGlobalValue(key: string): Promise<string | null> {
const val = await withRetry(() =>
this.client.get(this.globalValueKey(key))
);
return val ? ensureString(val) : null;
}
async setGlobalValue(key: string, value: string): Promise<void> {
await withRetry(() =>
this.client.set(this.globalValueKey(key), ensureString(value))
);
}
async deleteGlobalValue(key: string): Promise<void> {
await withRetry(() => this.client.del(this.globalValueKey(key)));
}
}
// 单例 Upstash Redis 客户端