mem模式支持持久化
parent
c01c726ea4
commit
3263ca98d7
|
@ -4,14 +4,7 @@
|
|||
* @date 2020/09/18 16:35:26
|
||||
*/
|
||||
|
||||
function hideProperty(host, name, value) {
|
||||
Object.defineProperty(host, name, {
|
||||
value: value,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
import fs from 'fs'
|
||||
|
||||
export default class Session {
|
||||
constructor(opt) {
|
||||
|
@ -33,7 +26,7 @@ export default class Session {
|
|||
}
|
||||
|
||||
// 设置session有效期
|
||||
hideProperty(session, '__expires__', Date.now() + this.ttl * 1000)
|
||||
session.__expires__ = Date.now() + this.ttl * 1000
|
||||
}
|
||||
|
||||
// 获取session字段值
|
||||
|
|
Loading…
Reference in New Issue