Home > Database > Mysql Tutorial > 再次改动了 tornado-memcache

再次改动了 tornado-memcache

WBOY
Release: 2016-06-07 16:29:41
Original
1112 people have browsed it

在上次(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)` method, 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 later
Signed-off-by: Wang Xu <gnawux>

</gnawux>
Copy after login

简单地说就是两件事情:

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

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

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template