New to caching...
新的缓存......
I was looking into Spring's EHCache and I found its "write-behind" new feature very interesting. Data is written to the cache first and then to the underlying database in an asynchronous way reducing the load on the database through time-shifting, rate-limiting, or conflation (by the way, do other caches have the same capabilities?). It just sounds great for what I need.
我正在研究Spring的EHCache,我发现它的“后写”新功能非常有趣。首先将数据写入缓存,然后以异步方式写入底层数据库,通过时移,速率限制或混合减少数据库的负载(顺便说一下,其他缓存是否具有相同的功能?)。这听起来很棒我需要的东西。
Now..
现在..
What happens if my server/system/cache crashes badly (i mean really badly) for any reasons? Would I loose data stored in the cache that is waiting to be loaded into the database? Can I prevent this from happening by using 'Big Memory' or 'Disk Store' and would these options be convenient?
如果我的服务器/系统/缓存由于任何原因严重崩溃(我的意思是非常糟糕)会发生什么?我是否会丢失存储在等待加载到数据库中的缓存中的数据?我可以通过使用“大内存”或“磁盘存储”来防止这种情况发生吗?这些选项会方便吗?
Thank you very much.
非常感谢你。
2 个解决方案
#1
1
A Terracotta cluster would give you a durable write-behind queue http://ehcache.org/documentation/apis/write-through-caching#using-a-combined-read-through-and-write-behind-cache and http://vimeo.com/21193026
Terracotta集群将为您提供持久的后写队列http://ehcache.org/documentation/apis/write-through-caching#using-a-combined-read-through-and-write-behind-cache和http: //vimeo.com/21193026
#2
0
Would I loose [sic] data stored in the cache that is waiting to be loaded into the database?
我是否会丢失存储在等待加载到数据库中的缓存中的[sic]数据?
Yes, you would. This the trade-off you have to accept with "write-behind" caches.
是的,你愿意。这是你必须接受“后写”缓存的权衡。
If you need transactional integrity, you need to write directly to the transactional backing store, and then either flush the entry from the cache ("write-back"), or update the cache synchronously with the write to the data store ("write-through").
如果需要事务完整性,则需要直接写入事务性后备存储,然后从缓存中刷新条目(“回写”),或者与写入数据存储器同步更新缓存(“写入 - 通过”)。
#1
1
A Terracotta cluster would give you a durable write-behind queue http://ehcache.org/documentation/apis/write-through-caching#using-a-combined-read-through-and-write-behind-cache and http://vimeo.com/21193026
Terracotta集群将为您提供持久的后写队列http://ehcache.org/documentation/apis/write-through-caching#using-a-combined-read-through-and-write-behind-cache和http: //vimeo.com/21193026
#2
0
Would I loose [sic] data stored in the cache that is waiting to be loaded into the database?
我是否会丢失存储在等待加载到数据库中的缓存中的[sic]数据?
Yes, you would. This the trade-off you have to accept with "write-behind" caches.
是的,你愿意。这是你必须接受“后写”缓存的权衡。
If you need transactional integrity, you need to write directly to the transactional backing store, and then either flush the entry from the cache ("write-back"), or update the cache synchronously with the write to the data store ("write-through").
如果需要事务完整性,则需要直接写入事务性后备存储,然后从缓存中刷新条目(“回写”),或者与写入数据存储器同步更新缓存(“写入 - 通过”)。