mem模式支持持久化

v1^2
宇天 2020-10-04 23:15:26 +08:00
parent c01c726ea4
commit 3263ca98d7
1 changed files with 2 additions and 9 deletions

View File

@ -4,14 +4,7 @@
* @date 2020/09/18 16:35:26 * @date 2020/09/18 16:35:26
*/ */
function hideProperty(host, name, value) { import fs from 'fs'
Object.defineProperty(host, name, {
value: value,
writable: true,
enumerable: false,
configurable: true
})
}
export default class Session { export default class Session {
constructor(opt) { constructor(opt) {
@ -33,7 +26,7 @@ export default class Session {
} }
// 设置session有效期 // 设置session有效期
hideProperty(session, '__expires__', Date.now() + this.ttl * 1000) session.__expires__ = Date.now() + this.ttl * 1000
} }
// 获取session字段值 // 获取session字段值