Skip to content

Commit cd8fa4e

Browse files
committed
doctests: re-add set/get example
1 parent 0f3d0f3 commit cd8fa4e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

doctests/cmd-set-and-get.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// EXAMPLE: set_and_get
2+
// REMOVE_START
3+
import assert from "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();
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+
//REMOVE_END
23+
24+
// HIDE_START
25+
await client.quit();
26+
// HIDE_END

0 commit comments

Comments
 (0)