1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

clean SET command

This commit is contained in:
Leibale
2023-04-24 12:40:22 -04:00
parent 40cfb94ca2
commit 39bcac6484
2 changed files with 62 additions and 29 deletions

View File

@@ -92,8 +92,11 @@ Modifiers to commands are specified using a JavaScript object:
```typescript
await client.set('key', 'value', {
EX: 10,
NX: true
expiration: {
type: 'EX',
value: 10
},
condition: 'NX'
});
```
@@ -108,10 +111,9 @@ await client.hVals('key'); // ['value1', 'value2']
```typescript
await client.hSet('key', 'field', Buffer.from('value')); // 'OK'
await client.hGetAll(
commandOptions({ returnBuffers: true }),
'key'
); // { field: <Buffer 76 61 6c 75 65> }
await client.withFlags({
[TYPES.BLOB_STRING]: Buffer
}).hGetAll('key'); // { field: <Buffer 76 61 6c 75 65> }
```
### Unsupported Redis Commands
@@ -151,8 +153,7 @@ This pattern works especially well for blocking commands—such as `BLPOP` and `
```typescript
import { commandOptions } from 'redis';
const blPopPromise = client.blPop(
commandOptions({ isolated: true }),
const blPopPromise = client.isolated().blPop(
'key',
0
);