Home >Backend Development >Python Tutorial >Manage scheduled tasks through reidis
The main application scenarios are: one-time scheduled tasks with changing requirements.
Execute corresponding commands by monitoring redis expiration events. (Note: Because monitoring can only get the key, you need to store the specific execution content separately)
Also remember to modify the redis configuration: notify-keyspace-events Ex
import redis rdc = redis.StrictRedis() pubsub = rdc.pubsub() pubsub.psubscribe("__keyevent@0__:expired") while pubsub.subscribed: msg = pubsub.get_message() if msg: print msg