mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-23 04:22:02 -06:00
add: hDelete on LocalCache
This commit is contained in:
parent
9a6d4a8e44
commit
0ad330bdb3
17
src/cache/localcache.ts
vendored
17
src/cache/localcache.ts
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user