Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const _getChannel = (slug, page = 1, cb) => {
  2.   const key = `channelpage-channel-${ slug }-${ page }`;
  3.   client
  4.     .getAsync(key)
  5.     .then((result) => {
  6.       if (result) return cb(null, JSON.parse(result));
  7.       _requestChannelWithVideos(slug, page)
  8.       .then((data) => {
  9.         cb(null, data);
  10.         client.set(key, JSON.stringify(data));
  11.         client.expire(key, _redisExpire);
  12.       })
  13.       .catch(cb);
  14.     })
  15.     .catch(cb);
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement