[英]Best way to reload data in Redis (or other cache service) upon restart?
When the Redis server fails and restarts, what's the best way to reload data into Redis? 当Redis服务器发生故障并重新启动时,将数据重新加载到Redis的最佳方法是什么? (I'm a bit new to Redis and in-memory databases) (我对Redis和内存数据库有点陌生)
I have three parts, I'll describe them as follows: 我分为三个部分,分别描述如下:
Some options I'm considering: 我正在考虑的一些选择:
Reloading data into Redis or any other cache is called cache-warming. 将数据重新加载到Redis或任何其他缓存中被称为缓存预热。 The problem you seem to have is that you're not trying to use Redis as a cache but as a means to communicate between the apps. 您似乎遇到的问题是,您不是要使用Redis作为缓存,而是要在应用之间进行通信。
Normally you would want your application to query Redis to see if there's data in there and if not query the endpoint or database so you should always have some kind of means to go without Redis. 通常,您希望您的应用程序查询Redis,以查看其中是否有数据,如果不查询端点或数据库,则应该始终采用某种方式来避免Redis。
Whether you have the producer purge the consumer's cache or have consumer mind it's own cache and deal with stale data or introduce another application just for serving the data would depends on your exact needs. 是让生产者清除消费者的缓存,还是让消费者注意它自己的缓存并处理陈旧数据,或者引入另一个仅用于服务数据的应用程序,这取决于您的确切需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.