zoukankan      html  css  js  c++  java
  • 不看源码,勿用代码

    http://redis-py.readthedocs.io/en/latest/_modules/redis/client.html

            return self.execute_command(command, *pieces, **kwargs)
    
    
    
    [docs]class Redis(StrictRedis):
        """
        Provides backwards compatibility with older versions of redis-py that
        changed arguments to some commands to be more Pythonic, sane, or by
        accident.
        """
    
        # Overridden callbacks
        RESPONSE_CALLBACKS = dict_merge(
            StrictRedis.RESPONSE_CALLBACKS,
            {
                'TTL': lambda r: r >= 0 and r or None,
                'PTTL': lambda r: r >= 0 and r or None,
            }
        )
    
    [docs]    def pipeline(self, transaction=True, shard_hint=None):
            """
            Return a new pipeline object that can queue multiple commands for
            later execution. ``transaction`` indicates whether all commands
            should be executed atomically. Apart from making a group of operations
            atomic, pipelines are useful for reducing the back-and-forth overhead
            between the client and server.
            """
            return Pipeline(
                self.connection_pool,
                self.response_callbacks,
                transaction,
                shard_hint)
    
    
    [docs]    def setex(self, name, value, time):
            """
            Set the value of key ``name`` to ``value`` that expires in ``time``
            seconds. ``time`` can be represented by an integer or a Python
            timedelta object.
            """
            if isinstance(time, datetime.timedelta):
                time = time.seconds + time.days * 24 * 3600
            return self.execute_command('SETEX', name, time, value)
    
    
    [docs]    def lrem(self, name, value, num=0):
            """
            Remove the first ``num`` occurrences of elements equal to ``value``
            from the list stored at ``name``.
    
            The ``num`` argument influences the operation in the following ways:
                num > 0: Remove elements equal to value moving from head to tail.
                num < 0: Remove elements equal to value moving from tail to head.
                num = 0: Remove all elements equal to value.
            """
            return self.execute_command('LREM', name, num, value)
    
    
    [docs]    def zadd(self, name, *args, **kwargs):
            """
            NOTE: The order of arguments differs from that of the official ZADD
            command. For backwards compatability, this method accepts arguments
            in the form of name1, score1, name2, score2, while the official Redis
            documents expects score1, name1, score2, name2.
    
            If you're looking to use the standard syntax, consider using the
            StrictRedis class. See the API Reference section of the docs for more
            information.
    
            Set any number of element-name, score pairs to the key ``name``. Pairs
            can be specified in two ways:
    
            As *args, in the form of: name1, score1, name2, score2, ...
            or as **kwargs, in the form of: name1=score1, name2=score2, ...
    
            The following example would add four values to the 'my-key' key:
            redis.zadd('my-key', 'name1', 1.1, 'name2', 2.2, name3=3.3, name4=4.4)
            """
            pieces = []
            if args:
                if len(args) % 2 != 0:
                    raise RedisError("ZADD requires an equal number of "
                                     "values and scores")
                pieces.extend(reversed(args))
            for pair in iteritems(kwargs):
                pieces.append(pair[1])
                pieces.append(pair[0])
            return self.execute_command('ZADD', name, *pieces)
    
    
    
    class PubSub(object):
    

      

    解决办法:

    import os,signal

    找到PID,kill


    from redis import *
    redis_key = ['192.168.3.212', '6379', 'nfwt&2016', 4]
    def return_redis(redis_key):
        REDIS_HOST, REDIS_PORT, PASSWORD, db = redis_key
        rds = Redis(host=REDIS_HOST, port=REDIS_PORT, password=PASSWORD, db=db)
        return rds
    
    
    
    rds = return_redis(redis_key)
    
    import os,signal
    
    os.kill(rds.connection_pool.pid,signal.SIGKILL)



  • 相关阅读:
    听豆瓣架构变迁分享会总结
    业界对生成图片缩略图的做法归纳
    58和百姓网的技术学习
    减少存储过程封装业务逻辑-web开发与传统软件开发的思维模式不同
    网站速度问题排查与定位经验
    调度思想-现实中的事物与技术里面其实存在类似道理
    关于图片或者文件在数据库的存储方式归纳
    mysql单表体积和一个库设计多少张表为妥
    php的变量引用与销毁机制
    选择技术方案权衡时,考虑对其可控性很重要
  • 原文地址:https://www.cnblogs.com/rsapaper/p/9074232.html
Copyright © 2011-2022 走看看