1
0
mirror of https://github.com/redis/node-redis.git synced 2025-07-31 05:44:24 +03:00
Files
node-redis/examples/command-with-modifiers.js
2025-05-05 11:35:41 +03:00

32 lines
528 B
JavaScript

// Define a custom script that shows example of SET command
// with several modifiers.
import { createClient } from 'redis';
const client = createClient();
await client.connect();
await client.del('mykey');
console.log(
await client.set('mykey', 'myvalue', {
expiration: {
type: 'EX',
value: 60
},
GET: true
})
); // null
console.log(
await client.set('mykey', 'newvalue', {
expiration: {
type: 'EX',
value: 60
},
GET: true
})
); // 'myvalue'
await client.close();