soveran

Lightweight

Redic is a lightweight Redis client for Ruby. It was first released in April 2013 and has been stable ever since, with some small additions here and there. It was inspired by redigo, a Redis client for golang, and consequently it tries to be mostly a transport layer. It uses hiredis for writing and reading from the socket and for parsing the Redis protocol.

The fact that it's a transport layer means that most of the time, reading the documentation for Redis itself is enough to understand how to use Redic. For instantiating a client, reconfiguring the connection, or pipelining commands, the API is very simple and easy to use.

This client is used by libraries like Ohm and Ost, and extended functionality is available via redic-cluster and redic-pool.

It was also the inspiration for writing a lightweight Redis client for Lua, which can also be used as a RESP translator.

Using a simple client like Redic can be frustrating or liberating, depending on your taste. Instead of the idiomatic client.ping you need to write client.call("PING"), which looks raw. On the other hand, such low level access allows for a simpler implementation and more maintainable code. When a new command is added to Redis, the client just works. That's why even if it's been used in production for a long time, and Redis got many new features, Redic only got 72 commits at the time of writing this article, almost two years after the release of the first stable version.

Check the docs and install the gem if you want to give it a try. Keep in mind that redis-rb is also a good Redis client, and for end users it may be a better choice given its idiomatic nature. Even though Redic can be used directly, it probably shines when used as a building block for creating other tools.