Tabnine Logo For Javascript
redis
Code IndexAdd Tabnine to your IDE (free)

How to use redis

Best JavaScript code snippets using redis(Showing top 15 results out of 1,773)

origin: cube-js/cube.js

Promise.all(
  addedToFront.map(
   s => redisClient.setAsync(storyAddedEventRedisKey(s), JSON.stringify(s), 'EX', 60 * 60 * 24 * 10)
  )
 )
origin: hua1995116/webchat

function resetCacheById(key) {
  return new Promise((resv, rej) => {
    client.getset(key, 0, (err, reply) => {
      resv(1);
    });
  })
}
origin: hua1995116/webchat

client.on("error", function (err) {
  console.log("Error " + err);
});
origin: cube-js/cube.js

const cached = async (key, getFn, expire) => {
 let value = await redisClient.getAsync(key);
 value = value !== 'undefined' && JSON.parse(value) || null;
 if (!value) {
  value = await getFn();
  await redisClient.setAsync(key, JSON.stringify(value), 'EX', expire || 3600);
 }
 return value;
}
origin: OmarElGabry/chat.io

let host = config.redis.host;
let password = config.redis.password;
let pubClient = redis(port, host, { auth_pass: password });
let subClient = redis(port, host, { auth_pass: password, return_buffers: true, });
io.adapter(adapter({ pubClient, subClient }));
origin: parse-community/parse-server

expect(redis.createClient).toHaveBeenCalledWith('redisAddress', {
 socket_keepalive: true,
 no_ready_check: true,
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', {
 socket_keepalive: true,
 no_ready_check: true,
origin: cube-js/cube.js

const prevStory = findPrevStory(oldList, s);
const storyFromApi = await cached(`${hnInsightsStateKey}_STORY_${s.id}`, () => fetchStory(s.id), 60 * 60);
const addedToFrontEvent = JSON.parse(await redisClient.getAsync(storyAddedEventRedisKey(s)));
const oldStory = oldList && oldList.find(old => old.id === s.id);
if (storyFromApi && s.score) {
origin: hua1995116/webchat

function getCacheById(key) {
  return new Promise((resv, rej) => {
    client.get(key, (err, reply) => {
      resv(reply);
    });
  })
  
}
origin: hua1995116/webchat

function gethAllCache(id) {
  return new Promise((resv, rej) => {
    client.hkeys(id, (err, res) => {
      resv(res);
    })
  })
}
origin: hua1995116/webchat

function inrcCache(key) {
  return new Promise((resv, rej) => {
    client.incr(key, (err, res) => {
      resv(1);
    });
  })
}
origin: hua1995116/webchat

function deleteCacheById(key) {
  return new Promise((resv, rej) => {
    client.del(key, (err, reply) => {
      resv(1);
    });
  })
}
origin: LFB/nodejs-koa-blog

redisClient.on('error', err => {
 console.log('Redis err')
 console.log(err)
})
origin: hua1995116/webchat

function updatehCache(id, key, value) {
  return new Promise((resv, rej) => {
    client.hset(id, key, value, (err, res) => {
      resv(1);
    })
  })
}
origin: hua1995116/webchat

function gethCacheById(id, key) {
  return new Promise((resv, rej) => {
    client.hmget(id, key, (err, res) => {
      resv(res[0]);
    })
  })
}
origin: hua1995116/webchat

function updateCache(key, value) {
  return new Promise((resv, rej) => {
    client.getset(key, value, (err, res) => {
      resv(1);
    })
  })
}
redis(npm)

JSDoc

Redis client library

Most used redis functions

  • RedisClient.on
  • RedisClient.get
    Get the value of a key.
  • createClient
  • RedisClient.set
    Set the string value of a key.
  • RedisClient.del
    Delete a key.
  • RedisClient.expire,
  • RedisClient.publish,
  • RedisClient.lpush,
  • RedisClient.hgetall,
  • RedisClient.quit,
  • RedisClient.auth,
  • RedisClient.incr,
  • RedisClient.getAsync,
  • RedisClient.setex,
  • RedisClient.hmset,
  • RedisClient.hset,
  • RedisClient.llen,
  • RedisClient.setAsync,
  • RedisClient.hkeys

Popular in JavaScript

  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • redis
    Redis client library
  • crypto
  • glob
    a little globber
  • aws-sdk
    AWS SDK for JavaScript
  • axios
    Promise based HTTP client for the browser and node.js
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • mongodb
    The official MongoDB driver for Node.js
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now