前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >read-through,write-through与write-behind模式

read-through,write-through与write-behind模式

作者头像
随风溜达的向日葵
发布2018-08-15 11:47:24
2.3K0
发布2018-08-15 11:47:24
举报
文章被收录于专栏:技术墨客

在hazelcast的官方文档中,提到了其支持read-through,write-through与write-behind三种模式。查阅资料,最后在oracle的官文中找到了比较靠谱的解释。

read-throug、write-through、write-behind三个概念都是关于数据缓存管理的。其实这些概念在实际使用的过程中经常接触。

Read-throug

当应用系统向缓存系统请求数据时(例如使用key=x向缓存请求数据);如果缓存中并没有对应的数据存在(key=x的value不存在),缓存系统将向底层数据源的读取数据。如果数据在缓存中存在(命中key=x),则直接返回缓存中存在的数据。这就是所谓的Read-throug。

hazelcast原文:

If an entry does not exist in the memory when an application asks for it, Hazelcast asks your loader implementation to load that entry from the data store。  If the entry exists there, the loader implementation gets it, hands it to Hazelcast, and Hazelcast puts it into the memory. This is read-through persistence mode。

下图是Oracle官网的Read-throug图例。

Write-Through

当应用系统对缓存中的数据进行更新时(例如调用put方法更新或添加条目),缓存系统会同步更新缓存数据和底层数据源。

下图展示了执行过程:

Write-Behind

当应用系统对缓存中的数据进行更新时(例如调用put方法更新或添加条目),缓存系统会在指定的时间后向底层数据源更新数据。

原文地址:https://www.chkui.com/article/hazelcast/read_through_write_through_and_write_behind

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016/05/17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Read-throug
  • Write-Through
  • Write-Behind
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档