MCPcopy
hub / github.com/tj/connect-redis / set

Method set

index.ts:58–75  ·  view source on GitHub ↗
(sid: string, sess: SessionData, cb?: Callback)

Source from the content-addressed store, hash-verified

56 }
57
58 async set(sid: string, sess: SessionData, cb?: Callback) {
59 let key = this.prefix + sid
60 let ttl = this.getTTL(sess)
61 try {
62 if (ttl > 0) {
63 let val = this.serializer.stringify(sess)
64 if (this.disableTTL) await this.client.set(key, val)
65 else
66 await this.client.set(key, val, {
67 expiration: {type: "EX", value: ttl},
68 })
69 return optionalCb(null, null, cb)
70 }
71 return this.destroy(sid, cb)
72 } catch (err) {
73 return optionalCb(err, null, cb)
74 }
75 }
76
77 async touch(sid: string, sess: SessionData, cb?: Callback) {
78 let key = this.prefix + sid

Callers 2

lifecycleTestFunction · 0.80
loadFunction · 0.80

Calls 4

getTTLMethod · 0.95
destroyMethod · 0.95
optionalCbFunction · 0.85
stringifyMethod · 0.80

Tested by

no test coverage detected