Esempio n. 1
0
    def pipeline(self,
                 transaction=None,
                 shard_hint=None,
                 read_from_replicas=False):
        """
        Cluster impl:
            Pipelines do not work in cluster mode the same way they do in normal mode.
            Create a clone of this object so that simulating pipelines will work correctly.
            Each command will be called directly when used and when calling execute() will only return the result stack.
        """
        if shard_hint:
            raise RedisClusterException(
                "shard_hint is deprecated in cluster mode")

        if transaction:
            raise RedisClusterException(
                "transaction is deprecated in cluster mode")

        return ClusterPipeline(
            connection_pool=self.connection_pool,
            startup_nodes=self.connection_pool.nodes.startup_nodes,
            result_callbacks=self.result_callbacks,
            response_callbacks=self.response_callbacks,
            cluster_down_retry_attempts=self.cluster_down_retry_attempts,
            read_from_replicas=read_from_replicas,
        )
Esempio n. 2
0
    def pipeline(self, transaction=None, shard_hint=None):
        """
        Cluster impl:
            Pipelines do not work in cluster mode the same way they do in normal mode.
            Create a clone of this object so that simulating pipelines will work correctly.
            Each command will be called directly when used and when calling execute() will only return the result stack.
        """
        if shard_hint:
            raise RedisClusterException(
                "shard_hint is deprecated in cluster mode")
        #Hendrik: Make sure that you use only pipelining and transactions on the same shard!
        #if transaction:
        #    raise RedisClusterException("transaction is deprecated in cluster mode")

        return ClusterPipeline(
            connection_pool=self.connection_pool,
            startup_nodes=self.connection_pool.nodes.startup_nodes,
            result_callbacks=self.result_callbacks,
            response_callbacks=self.response_callbacks,
        )