I have not used distributed ones in actual development. Let’s discuss it with you. My thoughts are:
Use redis Pub/Sub method to subscribe to the updates of the secondary cache. When a machine updates the cache, thenPub一个Key,通知所有的客户端,客户端前往更新,刷新一级缓存。key的值可以按机器号:数据key,这样搞,通过机器号判断让更新者不要更新,其它机器更新,数据keyupdate the specified data.
Consider whether the first-level cache is really needed. Will not using the first-level cache cause any problems? If it is a performance issue that can be ignored, I tend to use redis directly as the first-level cache, saving time, effort and complexity :)
I have not used distributed ones in actual development. Let’s discuss it with you.
My thoughts are:
Pub
一个Key
,通知所有的客户端,客户端前往更新,刷新一级缓存。key
的值可以按机器号:数据key
,这样搞,通过机器号判断让更新者不要更新,其它机器更新,数据key
update the specified data.The background scheduled task synchronizes the redis cache to the memory cache