本文整理匯總了Python中redis.client.StrictRedis.hlen方法的典型用法代碼示例。如果您正苦於以下問題:Python StrictRedis.hlen方法的具體用法?Python StrictRedis.hlen怎麽用?Python StrictRedis.hlen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redis.client.StrictRedis
的用法示例。
在下文中一共展示了StrictRedis.hlen方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: StrictRedis
# 需要導入模塊: from redis.client import StrictRedis [as 別名]
# 或者: from redis.client.StrictRedis import hlen [as 別名]
# -*- coding: gbk -*-
'''
Created on 2012-5-26
@author: Sky
'''
from redis.client import StrictRedis
Sr = StrictRedis(host='localhost', port=6379, db=0)
Sr.set('foo', 'bar')
#print(str(Sr.get('foo'), encoding = "utf-8") == 'bar')
print(Sr.get('foo'))
Sr.hset("MyHash", "field1", "ль¤У")
print(Sr.hget("MyHash", "field11"))
Sr.rpush("list", "one")
Sr.rpush("list", "two")
print(Sr.llen("list"))
Sr.ltrim("list", 1, 0)
print(Sr.llen("list"))
Sr.hset("MyHash", "Key1", "Value1")
Sr.hset("MyHash", "Key2", "Value2")
for i in Sr.hkeys("MyHash"):
print(i)
print(Sr.hlen("PlayerHash"))
print(Sr.get("XXX"))
print(type(Sr.smembers("EnemyTemplate:16:LOOT")))
for i in Sr.smembers("EnemyTemplate:16:LOOT"):
print(i)