写入缓存Ehcache后面的新功能? [英] write behind cache Ehcache new feature?

查看:109
本文介绍了写入缓存Ehcache后面的新功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找关于如何在ehcache中使用这个新功能write-behind-cache的指南/文档/教程?在Spring + jpa + ehcache + hibernate中有没有演示?

只是为了clariyfing,write-behind-cache意味着每次我们坚持实体时,它会写入缓存而不是数据库正确?

解决方案

Ehcache提供Write-Behind Caching这一事实 NOT 意味着任何使用和Hibernate一样,Ehcache可以不加修改地利用它。从 Terracotta的Hibernate集成(请注意,这是一个非独立帖子即亲缓存):


写后缓存



当您想到缓存您将达到
这些缓存策略:通读
缓存,直写式缓存,
写后缓存。 Hibernate Second
级别缓存是Read-Write-Through
Cache
,如果发生缓存未命中,则从数据库读取
实体,然后将
移交给缓存后续的
访问。 但H2LC不是
高速缓存写入
。使用Terracotta的磁盘
持久性和异步模块
,对于
特定的用例来实现
后置记录将非常有效。 目前Hibernate只需
直接写入数据库
。如果将其修改为写入第二个
级缓存和持久性
async-database-queue,而不是
,则
会减少延迟并显着增加
的吞吐量。


换句话说,后置缓存并不是Hibernate目前的工作方式(我可能错了,但我认为这不会发生在不久的将来改变)。但请随时提出 Jira 问题:)


i looking for guide/document/tutorial on how to use this new feature write-behind-cache in ehcache? Is there any demo in spring+jpa+ehcache+hibernate?

just to clariyfing, write-behind-cache mean each time we persist entity, it will be written into cache rather than into database correct?

解决方案

The fact that Ehcache offers Write-Behind Caching does NOT mean that any piece of software using Ehcache, like Hibernate, can leverage it without modification. From Terracotta's Hibernate Integration (note that this is a non independent post i.e. pro caching):

Write-Behind Caching

When you think of cache you will arrive at these cache strategies : Read-Through Caching, Write-Through Caching, Write-Behind Caching. Hibernate Second Level cache is Read-Write-Through Cache where if cache miss occurs, entity is read from database and then handed over to cache for susequent access. But H2LC is not Write-Behind caching. With Terracotta's disk persistence and asynchronsous module it would be really efficient for certain use-cases to implement write-behind. Currently Hibernate just directly writes to database. Instead if its modified to write to second level cache and persistent async-database-queue, this would decrease latency and increase throughput dramatically.

In other words, write-behind caching is just not how Hibernate currently works (and I may be wrong but I don't think this is going to change in a a near future). But feel free to raise a Jira issue :)

这篇关于写入缓存Ehcache后面的新功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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