Redis3.0的Python集群客戶端:redis-py-cluster
Python的集群客戶端官方集群支持針對Redis的3.0。 這個項目是 redis-rb-cluster的一個移植,并增加許多附加功能。
依賴和支持的Python版本
- redis >= 2.9.1
- Cluster enabled redis servers. Only Redis 3.0 beta.7 and above is supported because of CLUSTER SLOTS command was introduced in that release. </ul>
- 2.7 + hiredis
- 3.2 + hiredis
- 3.3 + hiredis
- 3.4 + hiredis
Current python support is
使用示例
Small sample script that show how to get started with RedisCluster. decode_responses=True
is required to have when running on python3.
>>> from rediscluster import RedisCluster >>> startup_nodes = [{"host": "127.0.0.1", "port": "7000"}] >>> rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True) >>> rc.set("foo", "bar") True >>> rc.get("foo") 'bar'
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!