“NodeJs Redis” Código de respuesta

Redis NodeJs

/* npm install redis */

const redis = require("redis");
const client = redis.createClient();

client.on("error", function(error) {
  console.error(error);
});

client.set("key", "value", redis.print);
client.get("key", redis.print);
joakimjohansson.se

NodeJs Redis

const redis = require('redis')
const client = redis.createClient()

client.on('error', (err) => {
  console.log(`Error ${err}`)
})

client.set('string key', 'string val', redis.print)
client.hset('hash key', 'hashtest 1', 'some value', redis.print)
client.hset(['hash key', 'hashtest 2', 'some other value'], redis.print)

client.hkeys('hash key', (err, replies) => {
  console.log(`${replies.length} replies:`)

  replies.forEach((reply, i) => {
    console.log(`    ${i}: ${reply}`)
  })

  client.quit()
})
Joyous Jackal

Respuestas similares a “NodeJs Redis”

Preguntas similares a “NodeJs Redis”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código