May 2018
Beginner to intermediate
526 pages
11h 57m
English
We will need Python bindings for Redis. Install redis-py via pip using the following command:
pip install redis==2.10.6
You can find the redis-py docs at https://redis-py.readthedocs.io/.
The redis-py package offers two classes for interacting with Redis: StrictRedis and Redis. Both offer the same functionality. The StrictRedis class attempts to adhere to the official Redis command syntax. The Redis class extends StrictRedis, overriding some methods to provide backward compatibility. We will use StrictRedis since it follows the Redis command syntax. Open the Python shell and execute the following code:
>>> import redis>>> r = redis.StrictRedis(host='localhost', port=6379, db=0)
The preceding code creates a connection ...
Read now
Unlock full access