Storing data in Redis
Remote Dictionary Server (Redis) is an in-memory, key-value database, written in C. In the in-memory mode, Redis is extremely fast, with writing and reading being almost equally fast. Redis follows the publish/subscribe model and uses Lua scripts as stored procedures. Publish/subscribe makes use of channels to which a client can subscribe in order to receive messages. I had installed Redis version 3.2.6 at the time of writing the book. Redis can be downloaded from the Redis home page at http://redis.io/. After installing the Redis distribution, issue the following command to run the server:
$ src/redis-server
Now let's install a Python driver:
$ pip3 install redis
It's pretty easy to use Redis when you realize it's a giant dictionary. However, Redis does have its limitations. Sometimes, it's just convenient to store a complex object as a JSON string (or other format). That's what we are going to do with a Pandas DataFrame. Connect to Redis as follows:
r = redis.StrictRedis...