@autofleet/matmon 1.0.2-beta-2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ declare class RedisCache {
10
10
  constructor(options: any);
11
11
  get(key: any): Promise<any>;
12
12
  set(key: any, value: any): Promise<void>;
13
+ remove(key: any): Promise<void>;
13
14
  private lock;
14
15
  }
15
16
  export default RedisCache;
@@ -78,6 +78,19 @@ class RedisCache {
78
78
  }
79
79
  });
80
80
  }
81
+ remove(key) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ try {
84
+ if (this.locks[key]) {
85
+ yield this.locks[key]();
86
+ }
87
+ yield this.client.delAsync(key);
88
+ }
89
+ catch (err) {
90
+ throw new errors_1.RedisCacheError(`Failed to invalidate key ${key}`, err);
91
+ }
92
+ });
93
+ }
81
94
  lock(key) {
82
95
  return Promise.race([
83
96
  this.locker(key, this.lockDuration),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/matmon",
3
- "version": "1.0.2-beta-2",
3
+ "version": "1.0.3",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",