Exemplo n.º 1
0
 def client(self):
     if self._client is None:
         decode = not six.PY2
         self._client = redis_client.StrictRedis(host=self.ip,
                                                 port=self.port,
                                                 decode_responses=decode)
     return self._client
Exemplo n.º 2
0
 def _update_server_list(self):
     if self.redis_mgt is not None:
         self.remote_server_lists = self.redis_mgt.get_master_list()
         self.clients = {}
         for remote in self.remote_server_lists:
             remote_ip_port = remote['ip_port']
             ip_port = remote_ip_port.split(':')
             self.clients[remote_ip_port] = \
                 redis_client.StrictRedis(host=ip_port[0], port=ip_port[1])
Exemplo n.º 3
0
 def client(self):
     if self._client is None:
         self._client = redis_client.StrictRedis(host=self.ip,
                                                 port=self.port)
     return self._client
Exemplo n.º 4
0
# -*- coding: utf-8 -*-

from redis import client
from settings import configParser

redis_section = dict(configParser.items("redis"))
password = redis_section.get("redis.password") if str(
    redis_section.get("redis.password")) != 'None' else ""
redisClient = client.StrictRedis(host=redis_section.get("redis.host"),
                                 port=redis_section.get("redis.port"),
                                 db=redis_section.get("redis.db"),
                                 password=password)
Exemplo n.º 5
0
# -*- coding: utf-8 -*-

from redis import client
from mycrawler.settings import REDIS_URL

server = client.StrictRedis().from_url(REDIS_URL)
pipe = server.pipeline()
pipe.multi()
pipe.zrange('hehe', 0, 0).zremrangebyrank('hehe', 0, 0)
results, count = pipe.execute()
print results[0]