java - write behind cache Ehcache新特性?

标签 java hibernate spring ehcache

我正在寻找有关如何在 ehcache 中使用此新功能后写缓存的指南/文档/教程?有spring+jpa+ehcache+hibernate的demo吗?

澄清一下,write-behind-cache 意味着每次我们持久化实体时,它都会被写入缓存而不是数据库,对吗?

最佳答案

Ehcache 提供后写缓存的事实意味着任何使用 Ehcache 的软件,如 Hibernate,都可以在不修改的情况下利用它。来自 Terracotta's Hibernate Integration (请注意,这是一个非独立的帖子,即专业缓存):

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.

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

关于java - write behind cache Ehcache新特性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2817296/

相关文章:

java - 比较java中的两个整数字符串

java - 存储和检索数据的成本

hibernate - 相当于 Hibernate 的外部 id 生成器的 JPA 是什么?

java - 无法使用 session.createSQLQuery() 方法使用 Hibernate 更新 mySql 中的 DATETIME 类型列

java - 为什么我的交易没有提交?

Java 将 List<Vehicle> 转换为 List<Object>

Java 高低网格游戏

hibernate - Grails GORM-使用聚合函数时如何获取PagedResultList

java - 使用在不同的基于 java 的 Spring 配置文件中定义的原型(prototype) beans

java - Spring Boot 的多重构造函数注入(inject)歧义