refactor of data-service

This commit is contained in:
Boki 2025-06-12 08:03:09 -04:00
parent 3097686849
commit 54314a0cde
49 changed files with 2394 additions and 112 deletions

View file

@ -289,6 +289,19 @@ export class RedisCache implements CacheProvider {
);
}
async keys(pattern: string): Promise<string[]> {
return this.safeExecute(
async () => {
const fullPattern = `${this.keyPrefix}${pattern}`;
const keys = await this.redis.keys(fullPattern);
// Remove the prefix from returned keys to match the interface expectation
return keys.map(key => key.replace(this.keyPrefix, ''));
},
[],
'keys'
);
}
async health(): Promise<boolean> {
try {
const pong = await this.redis.ping();

View file

@ -16,6 +16,7 @@ export interface CacheProvider {
del(key: string): Promise<void>;
exists(key: string): Promise<boolean>;
clear(): Promise<void>;
keys(pattern: string): Promise<string[]>;
getStats(): CacheStats;
health(): Promise<boolean>;