@keyv/redis 5.1.6 → 6.0.0-alpha.2

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.
package/README.md CHANGED
@@ -419,34 +419,42 @@ You can learn more about the `createCluster` function in the [documentation](htt
419
419
 
420
420
  # Sentinel
421
421
 
422
- If you are using Sentinel to provide high availability for your Redis instances, you can pass in the `redisOptions` directly. Here is an example of how to do that:
422
+ If you are using Sentinel to provide high availability for your Redis instances, you can pass in the sentinel options directly to the `KeyvRedis` constructor:
423
423
 
424
424
  ```js
425
425
  import Keyv from 'keyv';
426
- import KeyvRedis, { createSentinel } from '@keyv/redis';
426
+ import KeyvRedis from '@keyv/redis';
427
427
 
428
- const sentinel = createSentinel({
429
- name: 'sentinel-db',
428
+ const keyv = new Keyv({
429
+ store: new KeyvRedis({
430
+ name: 'mymaster',
430
431
  sentinelRootNodes: [
431
- {
432
- host: '127.0.0.1',
433
- port: 26379,
434
- },
435
- {
436
- host: '127.0.0.1',
437
- port: 26380,
438
- },
439
- {
440
- host: '127.0.0.1',
441
- port: 26381,
442
- },
432
+ { host: '127.0.0.1', port: 26379 },
433
+ { host: '127.0.0.1', port: 26380 },
434
+ { host: '127.0.0.1', port: 26381 },
443
435
  ],
436
+ }),
444
437
  });
438
+ ```
439
+
440
+ For TypeScript users, the `RedisSentinelOptions` type is exported from the package:
441
+
442
+ ```typescript
443
+ import KeyvRedis, { type RedisSentinelOptions } from '@keyv/redis';
444
+
445
+ const sentinelOptions: RedisSentinelOptions = {
446
+ name: 'mymaster',
447
+ sentinelRootNodes: [
448
+ { host: '127.0.0.1', port: 26379 },
449
+ { host: '127.0.0.1', port: 26380 },
450
+ { host: '127.0.0.1', port: 26381 },
451
+ ],
452
+ };
445
453
 
446
- const keyv = new Keyv({ store: new KeyvRedis(sentinel) });
454
+ const keyvRedis = new KeyvRedis(sentinelOptions);
447
455
  ```
448
456
 
449
- You can learn more about the `createSentinel` function in the [documentation](https://github.com/redis/node-redis/blob/master/docs/sentinel.md) at https://github.com/redis/node-redis/tree/master/docs.
457
+ You can learn more about Sentinel configuration in the [documentation](https://github.com/redis/node-redis/blob/master/docs/sentinel.md) at https://github.com/redis/node-redis/tree/master/docs.
450
458
 
451
459
  # TLS Support
452
460
 
package/dist/index.cjs CHANGED
@@ -122,7 +122,7 @@ var KeyvRedis = class extends import_hookified.Hookified {
122
122
  * @param {KeyvRedisOptions} [options] Options for the adapter such as namespace, keyPrefixSeparator, and clearBatchSize.
123
123
  */
124
124
  constructor(connect, options) {
125
- super();
125
+ super({ throwOnEmptyListeners: false });
126
126
  const socket = {
127
127
  reconnectStrategy: defaultReconnectStrategy
128
128
  // Default timeout for the connection
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RedisClientType, RedisModules, RedisFunctions, RedisScripts, RespVersions, TypeMapping, RedisClusterType, RedisSentinelType, RedisClientOptions, RedisClusterOptions, RedisSentinelOptions } from '@redis/client';
2
- export { RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType, RedisSentinelType, createClient, createCluster, createSentinel } from '@redis/client';
2
+ export { RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType, RedisSentinelOptions, RedisSentinelType, createClient, createCluster, createSentinel } from '@redis/client';
3
3
  import { Hookified } from 'hookified';
4
4
  import { Keyv, KeyvStoreAdapter, KeyvEntry } from 'keyv';
5
5
  export { Keyv } from 'keyv';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RedisClientType, RedisModules, RedisFunctions, RedisScripts, RespVersions, TypeMapping, RedisClusterType, RedisSentinelType, RedisClientOptions, RedisClusterOptions, RedisSentinelOptions } from '@redis/client';
2
- export { RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType, RedisSentinelType, createClient, createCluster, createSentinel } from '@redis/client';
2
+ export { RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType, RedisSentinelOptions, RedisSentinelType, createClient, createCluster, createSentinel } from '@redis/client';
3
3
  import { Hookified } from 'hookified';
4
4
  import { Keyv, KeyvStoreAdapter, KeyvEntry } from 'keyv';
5
5
  export { Keyv } from 'keyv';
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ var KeyvRedis = class extends Hookified {
88
88
  * @param {KeyvRedisOptions} [options] Options for the adapter such as namespace, keyPrefixSeparator, and clearBatchSize.
89
89
  */
90
90
  constructor(connect, options) {
91
- super();
91
+ super({ throwOnEmptyListeners: false });
92
92
  const socket = {
93
93
  reconnectStrategy: defaultReconnectStrategy
94
94
  // Default timeout for the connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "5.1.6",
3
+ "version": "6.0.0-alpha.2",
4
4
  "description": "Redis storage adapter for Keyv",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,10 +42,10 @@
42
42
  "dependencies": {
43
43
  "@redis/client": "^5.10.0",
44
44
  "cluster-key-slot": "^1.1.2",
45
- "hookified": "^1.13.0"
45
+ "hookified": "^2.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "keyv": "^5.6.0"
48
+ "keyv": "^6.0.0-alpha.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@biomejs/biome": "^2.3.11",
@@ -55,7 +55,7 @@
55
55
  "timekeeper": "^2.3.1",
56
56
  "tsd": "^0.33.0",
57
57
  "vitest": "^4.0.16",
58
- "@keyv/test-suite": "^2.1.2"
58
+ "@keyv/test-suite": "^6.0.0-alpha.2"
59
59
  },
60
60
  "tsd": {
61
61
  "directory": "test"