|
|
@ -123,26 +123,6 @@ export default class RedisMockCacheMgr extends CacheMgr { |
|
|
|
return this.client.incrby(key, value); |
|
|
|
return this.client.incrby(key, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
async delAll(scope: string, pattern: string): Promise<any[]> { |
|
|
|
|
|
|
|
// Example: nc:<orgs>:model:*:<id>
|
|
|
|
|
|
|
|
const keys = await this.client.keys(`${this.prefix}:${scope}:${pattern}`); |
|
|
|
|
|
|
|
log( |
|
|
|
|
|
|
|
`RedisMockCacheMgr::delAll: deleting all keys with pattern ${this.prefix}:${scope}:${pattern}`, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
await Promise.all( |
|
|
|
|
|
|
|
keys.map( |
|
|
|
|
|
|
|
async (k) => |
|
|
|
|
|
|
|
await this.deepDel(scope, k, CacheDelDirection.CHILD_TO_PARENT), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return Promise.all( |
|
|
|
|
|
|
|
keys.map(async (k) => { |
|
|
|
|
|
|
|
await this.del(k); |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async getList( |
|
|
|
async getList( |
|
|
|
scope: string, |
|
|
|
scope: string, |
|
|
|
subKeys: string[], |
|
|
|
subKeys: string[], |
|
|
|