@keyv/redis 2.3.0 → 2.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "2.3.0",
3
+ "version": "2.3.3",
4
4
  "description": "Redis storage adapter for Keyv",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -9,9 +9,9 @@
9
9
  "clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov"
10
10
  },
11
11
  "xo": {
12
- "extends": "xo-lukechilds",
13
12
  "rules": {
14
- "unicorn/prefer-module": 0
13
+ "unicorn/prefer-module": 0,
14
+ "unicorn/prefer-node-protocol": 0
15
15
  }
16
16
  },
17
17
  "ava": {
@@ -47,7 +47,6 @@
47
47
  "@keyv/test-suite": "*",
48
48
  "ava": "^4.1.0",
49
49
  "delay": "^5.0.0",
50
- "eslint-config-xo-lukechilds": "^1.0.1",
51
50
  "keyv": "*",
52
51
  "nyc": "^15.1.0",
53
52
  "requirable": "^1.0.5",
package/src/index.d.ts CHANGED
@@ -1,14 +1,17 @@
1
- import EventEmitter from 'node:events';
1
+ import {EventEmitter} from 'events';
2
+ import {Store} from 'keyv';
3
+ import {Redis, Cluster} from 'ioredis';
2
4
 
3
- declare class KeyvRedis extends EventEmitter {
5
+ declare class KeyvRedis extends EventEmitter implements Store<string | undefined> {
4
6
  readonly ttlSupport: false;
7
+ namespace?: string | undefined;
5
8
  opts: Record<string, unknown>;
6
9
  redis: any;
7
- constructor(options?: string | KeyvRedis.Options);
8
- _getNamespace(): string;
10
+ constructor(options?: KeyvRedis.Options | Redis | Cluster);
11
+ constructor(uri: string | Redis | Cluster, options?: KeyvRedis.Options);
9
12
  get(key: string): Promise<string | undefined>;
10
13
  getMany(keys: string[]): Promise<string[] | undefined>;
11
- set(key: string, value: string | undefined): Promise<any>;
14
+ set(key: string, value: string | undefined, ttl?: number): Promise<any>;
12
15
  delete(key: string): boolean;
13
16
  deleteMany(keys: string[]): boolean;
14
17
  clear(): Promise<void>;
@@ -16,7 +19,7 @@ declare class KeyvRedis extends EventEmitter {
16
19
  has(key: string): boolean;
17
20
  }
18
21
  declare namespace KeyvRedis {
19
- interface Options {
22
+ interface Options extends ClientOpts {
20
23
  uri?: string | undefined;
21
24
  dialect?: string | undefined;
22
25
  }
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-ignore
2
1
  const EventEmitter = require('events');
3
2
  const Redis = require('ioredis');
4
3
 
@@ -12,7 +11,7 @@ class KeyvRedis extends EventEmitter {
12
11
  if (uri instanceof Redis || uri instanceof Redis.Cluster) {
13
12
  this.redis = uri;
14
13
  } else {
15
- options = { ...(typeof uri === 'string' ? { uri } : uri), ...options };
14
+ options = {...(typeof uri === 'string' ? {uri} : uri), ...options};
16
15
  this.redis = new Redis(options.uri, options);
17
16
  }
18
17