add: hDelete on LocalCache

This commit is contained in:
oismaelash 2024-10-02 15:15:12 -03:00
parent 9a6d4a8e44
commit 0ad330bdb3

View File

@ -80,8 +80,19 @@ export class LocalCache implements ICache {
}
}
async hDelete() {
console.log('hDelete not implemented');
return 0;
async hDelete(key: string, field: string) {
try {
const data = LocalCache.localCache.get(this.buildKey(key)) as Object;
if (data && field in data) {
delete data[field];
LocalCache.localCache.set(key, data);
return 1;
}
return 0;
} catch (error) {
this.logger.error(error);
}
}
}