分布式缓存和本地缓存之间的通知 [英] Notification between Distributed cache and local cache

查看:297
本文介绍了分布式缓存和本地缓存之间的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


任何人都可以指点一个简单的例子:由于另一个客户端的本地缓存发生变化,本地缓存会被更新吗?我似乎无法找到一个

10X

Itzik

Hi

can anyone point me to a simple example of Local cache being updated as a result of a change in the local cache of another client?
I can't seem to find one

10X

Itzik

推荐答案

我让我尝试放两个场景  /例子解释你这个。

1。本地缓存有两个实例:客户端1具有LC1&客户2有LC2。两个客户端都连接到同一个群集和缓存。

您通过客户端1输入了一个项目(密钥和对象)。该项目也插入LC1。
现在通过客户端2,您可以获得该密钥。您从后端获得对象,但LC2也会更新该项目。

2。本地缓存有两个实例:客户端1具有LC1&客户2有LC2。两个客户端都连接到同一个群集和缓存。
您通过客户端1放置了一个项目(密钥和对象)。该项目也插入LC1。通过客户端2和LC2获取该密钥也会更新该项目。

现在通过客户端1更新该项目(比较对象1到对象2)。在此LC1将更新,但LC2 将不会。您必须等待LC2中的项目过期,然后在LC2中更新对象。

理念:一旦项目位于本地缓存中,无论后端发生什么,都不会更新。解决这个问题的唯一方法是等待它过期/逐出然后再进行更新。

这是设计的。本地缓存的目的是更快地访问并提供性能优势。这就是为什么它被用于参考数据和当看跌/卖出比率低的原因。
希望这会有所帮助。
Harish。
会员 - AppFabric Cache Team
Hi ,
Let me try to put 2 scenarios / examples to explain you this .

1. There are two instances of Local Cache : Client 1 has LC1 & Client 2 has LC2 . Both clients are connected to the same cluster and cache .

You put an item ( key & object ) through Client 1 . The item is also inserted in LC1 .
Now through Client 2 you do a get on that key . You get the object from the backend but LC2 is also updated with that item .

2. There are two instances of Local Cache : Client 1 has LC1 & Client 2 has LC2 . Both clients are connected to the same cluster and cache .
You put an item ( key & object ) through Client 1 . The item is also inserted in LC1 . Do a get on that key through Client 2 and LC2 is also updated with that item .

Now update that item ( say object 1 to object 2 ) through client 1 . In this LC1 will be updated but LC2 wont be . You will have to wait for the item in LC2 to get expired and then do a get to update the object in LC2 .



Idea : Once an item is in a local cache it will not be updated whatever happens in the backend . The only way to work around this it to wait for it to get expired / evicted and then do a get to update it .

This is by design . The purpose of local cache is to have faster accesses and provide performance benefit . That is why it is used for reference data and when the put/get ratio is low .

Hope this helps .
Harish .
Member - AppFabric Cache Team


这篇关于分布式缓存和本地缓存之间的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆