Skip to content

Improve redis example #1676

Open
Open
@jovekuang

Description

@jovekuang

There are a few areas I think can be imporved for this redis example:

  1. The example is unclear how to add a host nane as there's only a port number here
    using redisConn = await Deno.connect({ port: 6379 });
  2. I am unable to get sendCommand to work by following this line.
    await redisClient.sendCommand(["SET", "hello", "world"]); // "OK"
    The error I am getting is
error: Uncaught (in promise) Error: -ERR unknown command 'SET,hello,world'
    throw new ErrorReplyError(decoder.decode(line));
          ^
    at tryParseErrorReply (https://deno.land/x/[email protected]/protocol/deno_streams/reply.ts:120:11)
    at tryReadErrorReply (https://deno.land/x/[email protected]/protocol/deno_streams/reply.ts:130:3)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async readReply (https://deno.land/x/[email protected]/protocol/deno_streams/reply.ts:24:5)
    at async RedisConnection.processCommandQueue (https://deno.land/x/[email protected]/connection.ts:366:21)

While I can get the set working by referencing the example on the Redis site here, but it's important to understand how to use sendCommand still with other Redis commands such as JSON.SET etc. I am unable to find a working example of sendCommand on the internet with JSON.SET unfortunately...

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationexample

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions