Home > Database > Redis > body text

How redis monitors key expiration

Release: 2020-03-18 09:31:25
forward
3629 people have browsed it

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
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template