gpt4 book ai didi

express - Redis是否实现touch方法?

转载 作者:行者123 更新时间:2023-12-03 06:41:18 24 4
gpt4 key购买 nike

这对于理解配置目的很重要。

如果它确实实现了touch方法,那么我可以安全地将resave设置为false

session({
// blah blah
resave: false
});

由于文档页面上尚不存在可用的信息,我将如何进行调查。

我确实找到了这个,但我认为这是不同的touch()

https://redis.io/commands/touch

最佳答案

是的,用于快速 session 的redis连接器实现了touch。如果查看relevant portion of the source(即redis支持express-session的方式)的connect-redis module,您会发现它确实实现了touch方法,除非传递了禁用它的选项。

以下是相关来源:

touch(sid, sess, cb = noop) {
if (this.disableTouch) return cb()

let key = this.prefix + sid
this.client.expire(key, this._getTTL(sess), (err, ret) => {
if (err) return cb(err)
if (ret !== 1) return cb(null, 'EXPIRED')
cb(null, 'OK')
})
}

关于express - Redis是否实现touch方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60801995/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com