redis nodejs

JavaScript
/* 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);yarn add redis connect-redis express-sessionasync function upsert(table, data) {
  let key = table;
  if (data && data.id) {
    key = key + '_' + data.id;
  }

  client.setex(key, 10, JSON.stringify(data));
  return true;
}

Source

Also in JavaScript: