@naturalcycles/redis-lib 3.3.1 → 3.3.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/dist/redisClient.d.ts +3 -3
- package/package.json +1 -1
- package/src/redisClient.ts +3 -9
package/dist/redisClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject, CommonLogger, NullableBuffer, NullableString, Promisable,
|
|
1
|
+
import { AnyObject, CommonLogger, NullableBuffer, NullableString, Promisable, UnixTimestamp } from '@naturalcycles/js-lib';
|
|
2
2
|
import { ReadableTyped } from '@naturalcycles/nodejs-lib';
|
|
3
3
|
import type { Redis, RedisOptions } from 'ioredis';
|
|
4
4
|
import type { ScanStreamOptions } from 'ioredis/built/types';
|
|
@@ -48,8 +48,8 @@ export declare class RedisClient implements CommonClient {
|
|
|
48
48
|
hmgetBuffer(key: string, fields: string[]): Promise<NullableBuffer[]>;
|
|
49
49
|
hincr(key: string, field: string, increment?: number): Promise<number>;
|
|
50
50
|
hincrBatch(key: string, incrementTuples: [string, number][]): Promise<[string, number][]>;
|
|
51
|
-
setWithTTL(key: string, value: string | number | Buffer, expireAt:
|
|
52
|
-
hsetWithTTL(_key: string, _value: AnyObject, _expireAt:
|
|
51
|
+
setWithTTL(key: string, value: string | number | Buffer, expireAt: UnixTimestamp): Promise<void>;
|
|
52
|
+
hsetWithTTL(_key: string, _value: AnyObject, _expireAt: UnixTimestamp): Promise<void>;
|
|
53
53
|
mset(obj: Record<string, string | number>): Promise<void>;
|
|
54
54
|
msetBuffer(obj: Record<string, Buffer>): Promise<void>;
|
|
55
55
|
incr(key: string, by?: number): Promise<number>;
|
package/package.json
CHANGED
package/src/redisClient.ts
CHANGED
|
@@ -6,12 +6,10 @@ import {
|
|
|
6
6
|
NullableString,
|
|
7
7
|
Promisable,
|
|
8
8
|
StringMap,
|
|
9
|
-
|
|
9
|
+
UnixTimestamp,
|
|
10
10
|
} from '@naturalcycles/js-lib'
|
|
11
11
|
import { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
12
|
-
// eslint-disable-next-line import-x/no-duplicates
|
|
13
12
|
import type { Redis, RedisOptions } from 'ioredis'
|
|
14
|
-
// eslint-disable-next-line import-x/no-duplicates
|
|
15
13
|
import type * as RedisLib from 'ioredis'
|
|
16
14
|
import type { ScanStreamOptions } from 'ioredis/built/types'
|
|
17
15
|
import type { ChainableCommander } from 'ioredis/built/utils/RedisCommander'
|
|
@@ -181,16 +179,12 @@ export class RedisClient implements CommonClient {
|
|
|
181
179
|
async setWithTTL(
|
|
182
180
|
key: string,
|
|
183
181
|
value: string | number | Buffer,
|
|
184
|
-
expireAt:
|
|
182
|
+
expireAt: UnixTimestamp,
|
|
185
183
|
): Promise<void> {
|
|
186
184
|
await this.redis().set(key, value, 'EXAT', expireAt)
|
|
187
185
|
}
|
|
188
186
|
|
|
189
|
-
async hsetWithTTL(
|
|
190
|
-
_key: string,
|
|
191
|
-
_value: AnyObject,
|
|
192
|
-
_expireAt: UnixTimestampNumber,
|
|
193
|
-
): Promise<void> {
|
|
187
|
+
async hsetWithTTL(_key: string, _value: AnyObject, _expireAt: UnixTimestamp): Promise<void> {
|
|
194
188
|
throw new Error('Not supported until Redis 7.4.0')
|
|
195
189
|
// const valueKeys = Object.keys(value)
|
|
196
190
|
// const numberOfKeys = valueKeys.length
|