@jusbid/redis 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/index.js +12 -1
  2. package/package.json +4 -1
package/index.js CHANGED
@@ -866,6 +866,16 @@ const xReadGroupNew = async (...args) => {
866
866
  }
867
867
  };
868
868
 
869
+
870
+ const deleteByPattern = async (pattern) => {
871
+ const keys = await redisClient.keys(pattern)
872
+ if (keys.length > 0) {
873
+ await redisClient.del(keys);
874
+ }
875
+
876
+ return keys.length;
877
+ }
878
+
869
879
  module.exports = {
870
880
  redisClient,
871
881
  get,
@@ -889,5 +899,6 @@ module.exports = {
889
899
  xAutoClaim,
890
900
  xDel,
891
901
  xTrim,
892
- xReadGroupNew
902
+ xReadGroupNew,
903
+ deleteByPattern
893
904
  };
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@jusbid/redis",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "index.js",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "redis": "^4.6.13",
8
8
  "@jusbid/logger": "1.0.0"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
9
12
  }
10
13
  }