You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-01 16:46:54 +03:00
* TCEs for select command pages * Preemptive modifications from previous reviews * Update to previous commit
28 lines
571 B
JavaScript
28 lines
571 B
JavaScript
// EXAMPLE: cmds_string
|
|
// REMOVE_START
|
|
import assert from "node:assert";
|
|
// REMOVE_END
|
|
|
|
// HIDE_START
|
|
import { createClient } from 'redis';
|
|
|
|
const client = createClient();
|
|
client.on('error', err => console.log('Redis Client Error', err));
|
|
await client.connect().catch(console.error);
|
|
// HIDE_END
|
|
|
|
// STEP_START incr
|
|
await client.set("mykey", "10");
|
|
const value1 = await client.incr("mykey");
|
|
console.log(value1);
|
|
// returns 11
|
|
// REMOVE_START
|
|
assert.equal(value1, 11);
|
|
await client.del('mykey');
|
|
// REMOVE_END
|
|
// STEP_END
|
|
|
|
// HIDE_START
|
|
await client.quit();
|
|
// HIDE_END
|