Home  >  Article  >  Database  >  How redis monitors key expiration

How redis monitors key expiration

尚
forward
2020-03-18 09:31:253630browse

How redis monitors key expiration

To enable redis to monitor key expiration, you need to add configuration.

Recommended: redis introductory tutorial

Implementation principle: In versions after Redis2.8, when we cache the pairs using Redis and When setting the cache expiration time, the Redis key event notification will be triggered. The client subscribes to this notification event, and the server will send the corresponding notification event to each subscribed client, and then the client will respond accordingly based on the received notification. Subsequent processing (for example: the topic corresponding to the key expiration time notification is: "keyevent@0:expired").

Because turning on the key space notification function requires some CPU, this function is turned off in the default configuration.

My configuration is like this:

notify-keyspace-events Ex

How redis monitors key expiration

Related recommendations:

mysql video tutorial:https: //www.php.cn/course/list/51.html

The above is the detailed content of How redis monitors key expiration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete