-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
增加 timeout 选项和相应的 renew, keys 接口 #2
Conversation
viemacs
commented
May 3, 2017
•
edited
Loading
edited
- Redis 使用 timeout (TTL) 选项时, table_name 需设置为空字符串 ""
- LevelDB 和 object/Map 现不支持 keys(), 无返回结果
lib/backend/Redis.js
Outdated
@@ -2,7 +2,7 @@ var utils = require('../utils'); | |||
|
|||
function getTable(conn, opts) { | |||
var name = utils.table_name(opts); | |||
return name ? conn.getHash(name) : conn; | |||
return !name || name === 'kvs' ? conn : conn.getHash(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis 时可以在 setup 时有 timeout 且 name 不为 '' 时抛出错误。强制要求将 name 设置为 '',
这样可以避免程序员错误设置参数。同时也可以减少下面代码的复杂性。
要把 readme 修改一下 |
460aaf4
to
88b4023
Compare
utils.key_name(opts) + ' VARCHAR(' + utils.key_size(opts) + ') PRIMARY KEY, ' + | ||
utils.value_name(opts) + ' VARCHAR(' + utils.value_size(opts) + '));'; | ||
utils.value_name(opts) + ' VARCHAR(' + utils.value_size(opts) + ')' + | ||
_v(opts, ', _timestamp BIGINT') + ');'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timestamp 改为 _timestamp; 在 timeout 不为正时, 不加 时间戳 字段. 以减少冲突的可能.
在 sqlite, mysql, mongodb 上有增加时间戳的问题. 对 sqlite, mysql 预先定义好的表, 如果开 timeout 需要在实现上再处理一下. |