python operation redis-zset

1.python operation redis-zset

= REDIS_HOST "10.133.3.26" 
REDIS_PORT = 6379 
REDIS_PASSWORK = "" 
REDIS_DB =. 3 

from the ConnectionPool Redis Import, StrictRedis 

the pool = the ConnectionPool (= Host REDIS_HOST, Port = REDIS_PORT, DB = REDIS_DB, 
                      # = REDIS_PASSWORK password,) 
                      ) 
Conn = StrictRedis ( = the pool connection_pool) 

conn.zadd ( 'appSellers',. 1, 'jiang') # add an element to the cis jiang set, its value is. 1 
conn.zscore ( 'appSellers', 'jiang') # Get jiang value of this element 
newScore = conn.zrange ( 'appSellers', 0, -1, desc = True, withscores = True) # Gets the collection element within the specified sequence 
newScore = conn.zrangebyscore ( 'appSellers', 80, 100 ) # Get element within the range specified fraction  
newScore = conn.zincrby ( 'appSellers', 'wolson ', 10) # increasing value specified element
newScore = conn.zcard ( 'appSellers'The number of elements) # Gets a collection of
newScore = conn.zcount ( 'appSellers', 90, 101) # Get the number of elements within the range of scores 
conn.zrem ( 'appSellers', 'wolson ') # remove the collection specified element 
conn.zremrangebyscore ( 'appSellers', 1, 20,000) # delete elements in the score during designated collection

  

  

Guess you like

Origin www.cnblogs.com/yoyo1216/p/11965746.html