You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
22 lines
391 B
JavaScript
22 lines
391 B
JavaScript
import { RESP_TYPES, createClient } from '@redis/client';
|
|
|
|
const client = createClient({
|
|
RESP: 3,
|
|
commandOptions: {
|
|
typeMapping: {
|
|
[RESP_TYPES.MAP]: Map
|
|
}
|
|
}
|
|
});
|
|
client.on('error', err => console.error(err));
|
|
|
|
await client.connect();
|
|
|
|
console.log(
|
|
await client.flushAll(),
|
|
await client.hSet('key', 'field', 'value'),
|
|
await client.hGetAll('key')
|
|
)
|
|
|
|
client.destroy();
|