redis-py is a Python client library for communicating with Redis, a network service that behaves much like a shared Python dictionary. Redis supports caching, message brokering, and quick information lookups. section 23.6
Install the client, connect to a running server, and use familiar Redis operations:
- Install with pip install redis. section 23.6
Expiring data
r.setex("timed", 10, "10 seconds") stores a value for ten seconds. After expiration, pttl returns -2 and the key is absent.
