1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-01 16:46:54 +03:00
Files
node-redis/doctests/cmds-string.js
David Dougherty fd7b10be6c TCEs for select command pages (#2824)
* TCEs for select command pages

* Preemptive modifications from previous reviews

* Update to previous commit
2024-09-26 14:27:12 +03:00

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