MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / getSession

Function getSession

helpers/session.js:13–29  ·  view source on GitHub ↗
(sessionId, callback)

Source from the content-addressed store, hash-verified

11module.exports = {
12
13 getSession(sessionId, callback) {
14 try {
15 config.redisClient.get(sessionId, (err, reply) => {
16 if (!err) {
17 if (reply) {
18 if (callback) callback(null, JSON.parse(reply));
19 } else if (callback) {
20 callback(null, {}); // pass an empty session.
21 }
22 } else if (callback) {
23 callback(err, null);
24 }
25 });
26 } catch (err) {
27 winston.log('error', { error: String(err), stack: new Error().stack });
28 }
29 },
30
31
32 /* Saves the user session into Redis.

Callers

nothing calls this directly

Calls 2

callbackFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected