Skip to content

Commit 9f810c2

Browse files
authored
Add back accidentally deleted doctests file (#2821)
* Add back accidentally deleted doctest file * Update string-set-get-example.js
1 parent 06e91d0 commit 9f810c2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

doctests/string-set-get-example.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// EXAMPLE: set_and_get
2+
// REMOVE_START
3+
import assert from "node:assert";
4+
// REMOVE_END
5+
6+
// HIDE_START
7+
import { createClient } from 'redis';
8+
9+
const client = createClient();
10+
11+
client.on('error', err => console.log('Redis Client Error', err));
12+
13+
await client.connect().catch(console.error);
14+
15+
// HIDE_END
16+
await client.set('bike:1', 'Process 134');
17+
const value = await client.get('bike:1');
18+
console.log(value);
19+
// returns 'Process 134'
20+
//REMOVE_START
21+
assert.equal(value, 'Process 134');
22+
await client.del('bike:1');
23+
//REMOVE_END
24+
25+
// HIDE_START
26+
await client.quit();
27+
// HIDE_END

0 commit comments

Comments
 (0)