Sure, here’s the translation: Hazelcast 插入和更新

huangapple go评论63阅读模式
英文:

Hazelcast insert and update

问题

我在我的应用程序中使用Hazelcast IMDG。

我有一个需求如下:

1] 当我提交数据时,将其插入到数据库和Hazelcast中。

2] 当我获取数据时,应从Hazelcast中获取。

3] 当删除数据时,应在两边都进行删除。

哪种方法是最佳选项。

我可以在Hazelcast中使用MapStore<?,?>吗?

英文:

I'm using hazelcast IMDG in my application.

I have a requirement like

1] When I post the data, insert in both db and hazelcast.

2]When I get the data, it should be from hazelcast.

3]When delete the data, do it the both the side..

which is the best option to that.

Can I with MapStore<?,?> in the hazelcast.?

答案1

得分: 1

是的,这正是 MapStore 所做的事情。

一个注意事项:MapStore 继承自 MapLoader。对于加载操作,你需要返回 null

因此,我建议你从 MapAdapter 继承自己,它是 MapStore 的一个空操作实现。

英文:

Yes, that's exactly what MapStore does.

One caveat: MapStore inherits from MapLoader. You'll need to return null for loading operations.

Hence, I'd recommend you inherit yourself from MapAdapter which is a no-op implementation of MapStore.

huangapple
  • 本文由 发表于 2020年9月30日 10:56:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/64130195.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定