Interacting with data in Redis
Redis is an advanced kind of key-value store where the values can be of different types: string, list, set, sorted set or hash. Redis stores data in memory like memcached but it can be persisted on disk, unlike memcached, which has no such option. Redis supports fast reads and writes, in the order of 100,000 set or get operations per second.
To interact with Redis, we need to install the
Redis-py module to Python, which is available on
pypi and can be installed with
$ pip install redis
Now, we can connect to Redis via the host and port of the DB server. We assume that we have already installed a Redis server, which is running with the default host (
localhost) and port (
>>> import redis >>> r ...