• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

再次改动了 tornado-memcache

mysql 搞代码 4年前 (2022-01-09) 28次浏览 已收录 0个评论

在上次(http://wangxu.me/blog/p/758)之后,再次改动了 tornado-memcache 模块,commit 信息如下: Add gets method and simplify connection estabilish – simplify connection estabilish procedure, as tornado.iostream permit write before connection

在上次(http://wangxu.me/blog/p/758)之后,再次改动了 tornado-memcache 模块,commit 信息如下:

Add gets method and simplify connection estabilish

- simplify connection estabilish procedure, as tornado.iostream  permit write before connection estabilished, I removed the  callback and connection timeout procedure in _get_server()- add `gets(self, keys, callback, failcallback)` met<a>本文来源gao($daima.com搞@代@#码8网^</a>hod, receive  a list of keys as parameter and return a dictionary of results  result = {key1:value1, key2:value2...}, only return the got  keys from memcached- some debug info, might be cleanup laterSigned-off-by: Wang Xu <gnawux……

简单地说就是两件事情:

  • 读了文档,发现 tornado 的 iostream 允许在连接建立未完成的时候就write,既然我之前已经用 iostream 管理 socket 了,这里就省掉上次在这里加上的callback 和 timeout,直接 write command,等 write 的超时或返回就好了;
  • 读了memcached 协议,发现取信息(get),是支持一次取多条信息的,于是加入了这个支持,这样,批处理操作时会提高不少效率。

里面还插入了好多调试的时候的 debug 信息,差不多都注掉了,回头都稳定了再清理一下。

嗯,代码都在 github 了:https://github.com/gnawux/tornado-memcache


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:再次改动了 tornado-memcache
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址