Pipeline API

class tornadis.Pipeline

Bases: object

Pipeline class to stack redis commands.

A pipeline object is just a kind of stack. You stack complete redis commands (with their corresponding arguments) inside it.

Then, you use the call() method of a Client object to process the pipeline (which must be the only argument of this call() call).

More informations on the redis side: http://redis.io/topics/pipelining

Variables:
  • pipelined_args – A list of tuples, earch tuple is a complete redis command.
  • number_of_stacked_calls – the number of stacked redis commands (integer).
__init__()

Constructor.

stack_call(*args)

Stacks a redis command inside the object.

The syntax is the same than the call() method a Client class.

Parameters:*args – full redis command as variable length argument list.

Examples

>>> pipeline = Pipeline()
>>> pipeline.stack_call("HSET", "key", "field", "value")
>>> pipeline.stack_call("PING")
>>> pipeline.stack_call("INCR", "key2")