兄弟,其实你应该先把 Beansdb 项目的说明看完……
Beansdb 通讯协议使用的是 memcached 文本协议。
via
https://github.com/douban/beansdb"""
...
It conforms to memcache protocol (not fully supported, see below), so any
memcached client can interactive with it without any modification.
...
Supported memcache commands
get
set(with version support)
append
incr
delete
stats
flush_all
Private commands
get @xxx, list the content of hash tree, such as @0f
get ?xxx, get the meta data of key.
Python Example
from dbclient import Beansdb
# three beansdb nodes on localhost
BEANSDBCFG = {
"localhost:7901": range(16),
"localhost:7902": range(16),
"localhost:7903": range(16),
}
db = Beansdb(BEANSDBCFG, 16)
db.set('hello', 'world')
db.get('hello')
db.delete('hello')
...
"""
(看代码 python/dbclient.py 主要是基于 python-memcached 库并在客户端使用 fnv1a 哈希算法做分布式处理。)