moaxaca / async-redis

First class async & promise support for redis.
Other
168 stars 21 forks source link

Simple instance error #11

Closed aaaaaajie closed 5 years ago

aaaaaajie commented 5 years ago
const client = require('async-redis').createClient('6379', '127.0.0.1');
const logger = require('tracer').console();

client.on("error", err => logger.log(err));

(async () => {
    await client.set("string key", "stringvalue");
    const value = await client.get("string key");
    logger.log(value);
    await client.flushall("string key");
})();

show result:

(node:2828) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReplyError: ERR wrong number of arguments for 'flushall' command
(node:2828) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'm a beginner,I want answers,thanks!

moaxaca commented 5 years ago

@iPenManShip If I remember correctly flushall doesn't take any parameters. You might be looking for del command.

await redisClient.set('hello', 'world');
const status = await redisClient.del('hello');