RedPipe: Pain-Free Pipelining

Did you try to use Redis pipelines? Did you get a pounding headache? Did you throw your laptop in frustration? Never fear. RedPipe will make you feel better almost immediately. If you have no idea what Redis is or why you should pipeline commands, look it up already.

BuildStatus CoverageStatus Version Python

Requirements

The redpipe module requires Python 3 or higher.

It also requires redis-py.

What is RedPipe?

RedPipe is a wrapper around the pipeline component of redis-py. It makes it easy to reduce network round trips when talking to Redis. The interface is very similar to redis-py. Pipelined commands work almost like non-pipelined commands.

For more general information about redis pipelining, see the official redis documentation.

Use RedPipe to build pipelined redis calls in a modular reusable way. Rewrite your existing application calls via redis-py into efficient batches with only minimal changes.

How Does it Work?

RedPipe makes pipeline commands work almost like non-pipelined commands in redis-py. You may have used pipelines before in a few spots as a last-minute performance optimization. Redpipe operates with a different paradigm. It assumes every call will be pipelined. And it gives you the tools to do it.

Some concepts sound complicated:

This documentation will explain all of these concepts and why they are important. All of these things together allow you to build modular functions that can be combined with other pipelined functions. You will be able to pass a pipeline into multiple functions, collect the results from each function, and then execute the pipeline to hydrate those result objects with data.

What do I Need to Know to Start?

If you’ve used redis-py, you know most of what you need already to start using RedPipe.

If not, head over there and play with redis-py first. Or check out this very easy tutorial on redis-py basics:

http://agiliq.com/blog/2015/03/getting-started-with-redis-py/

You’ll find the redpipe api looks nearly identical. That’s because RedPipe is a wrapper around redis-py.

RedPipe adds the ability to pipeline commands in a more natural way.

What Else Can it do?

You can use just the core of the RedPipe. Wrap your existing redis-py commands with RedPipe and profit. But the library unlocks a few other cool things too:

  • Keyspaces allow you to work more easily with collections of Redis keys.
  • Structs give you an object-oriented interface to working with Redis hashes.

Both components will make it easier to manipulate data in your application. And they are optimized for maximum network efficiency. You can pipeline Keyspaces and Structs just like you can with the core of RedPipe.


API Documentation

This part of the documentation provides detailed API documentation. Dig into the source code and see how everything ties together. This is what is great about open-source projects. You can see everything.