@keyv/redis 4.3.2 → 4.3.4

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/README.md +9 -7
  2. package/package.json +10 -8
package/README.md CHANGED
@@ -54,7 +54,7 @@ Here is the same example but with the `Keyv` instance created with the `createKe
54
54
  ```js
55
55
  import { createKeyv } from '@keyv/redis';
56
56
 
57
- const keyv = createKeyv('redis://user:pass@localhost:6379', { namespace: 'my-namespace' });
57
+ const keyv = createKeyv('redis://user:pass@localhost:6379');
58
58
  ```
59
59
 
60
60
  You only have to import the `@keyv/redis` library if you are using the `createKeyv` function. 🎉 Otherwise, you can import `Keyv` and `@keyv/redis` independently.
@@ -82,26 +82,28 @@ const redisOptions = {
82
82
  const keyv = new Keyv(new KeyvRedis(redisOptions));
83
83
  ```
84
84
 
85
- Or you can create a new Redis instance and pass it in with `KeyvOptions`:
85
+ Or you can create a new Redis instance and pass it in with `KeyvOptions` such as setting the `store`:
86
86
 
87
87
  ```js
88
88
  import Keyv from 'keyv';
89
89
  import KeyvRedis, { createClient } from '@keyv/redis';
90
90
 
91
- const redis = createClient('redis://user:pass@localhost:6379', { namespace: 'my-namespace'});
91
+ const redis = createClient('redis://user:pass@localhost:6379');
92
92
  const keyvRedis = new KeyvRedis(redis);
93
- const keyv = new Keyv({ store: keyvRedis });
93
+ const keyv = new Keyv({ store: keyvRedis});
94
94
  ```
95
95
 
96
96
  # Namespaces
97
97
 
98
- You can set a namespace for your keys. This is useful if you want to manage your keys in a more organized way. Here is an example of how to set a namespace:
98
+ You can set a namespace for your keys. This is useful if you want to manage your keys in a more organized way. Here is an example of how to set a `namespace` with the `store` option:
99
99
 
100
100
  ```js
101
101
  import Keyv from 'keyv';
102
- import KeyvRedis from '@keyv/redis';
102
+ import KeyvRedis, { createClient } from '@keyv/redis';
103
103
 
104
- const keyv = new Keyv(new KeyvRedis('redis://user:pass@localhost:6379', { namespace: 'my-namespace' }));
104
+ const redis = createClient('redis://user:pass@localhost:6379');
105
+ const keyvRedis = new KeyvRedis(redis);
106
+ const keyv = new Keyv({ store: keyvRedis, namespace: 'my-namespace' });
105
107
  ```
106
108
 
107
109
  This will prefix all keys with `my-namespace:`. You can also set the namespace after the fact:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "description": "Redis storage adapter for Keyv",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -35,17 +35,19 @@
35
35
  "homepage": "https://github.com/jaredwray/keyv",
36
36
  "dependencies": {
37
37
  "cluster-key-slot": "^1.1.2",
38
- "redis": "^4.7.0",
39
- "keyv": "^5.3.1"
38
+ "redis": "^4.7.0"
39
+ },
40
+ "peerDependencies": {
41
+ "keyv": "^5.3.3"
40
42
  },
41
43
  "devDependencies": {
42
- "@vitest/coverage-v8": "^3.0.7",
44
+ "@vitest/coverage-v8": "^3.1.1",
43
45
  "rimraf": "^6.0.1",
44
46
  "timekeeper": "^2.3.1",
45
47
  "tsd": "^0.31.2",
46
- "vitest": "^3.0.7",
48
+ "vitest": "^3.1.1",
47
49
  "xo": "^0.60.0",
48
- "@keyv/test-suite": "^2.0.5"
50
+ "@keyv/test-suite": "^2.0.6"
49
51
  },
50
52
  "tsd": {
51
53
  "directory": "test"
@@ -59,8 +61,8 @@
59
61
  ],
60
62
  "scripts": {
61
63
  "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
62
- "test": "xo --fix && vitest run --coverage --typecheck",
63
- "test:ci": "xo && vitest --run --sequence.setupFiles=list --typecheck",
64
+ "test": "xo --fix && vitest run --coverage",
65
+ "test:ci": "xo && vitest --run --sequence.setupFiles=list",
64
66
  "clean": "rimraf ./node_modules ./coverage ./dist"
65
67
  }
66
68
  }