Redis - any way to trigger an event when a value is no longer being actively written to?

此生再无相见时 提交于 2020-01-25 08:55:06

问题


I have a use case where I'm streaming and processing live data into an Elasticache Redis cluster. In essence, I want to kick off an event when all events of a certain type have completed (i.e. the size of a value is no longer growing over the course of 60 seconds).

For example:

foo [event1]
foo [event1, event2]
foo [event1, event2]
foo [event1, event2] -> triggers some event if this key/value is constant for 60 seconds.

Is this at all possible?


回答1:


I would suggest that as part of all "changing" commands also set a key with a 60-second ttl. You can then subscribe to the expiration of that key using redis keyspace notifications.



来源:https://stackoverflow.com/questions/59073206/redis-any-way-to-trigger-an-event-when-a-value-is-no-longer-being-actively-wri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!