SWEN00
qq_123
2009-04-15 12:07

ehcache 是线程安全的吗?以及缓存使用上的问题

  • hibernate

ehcache FAQ中提到

Remember that a value in a cache element is globally accessible from multiple threads. [color=red][b]It is inherently not thread safe to modify the value[/b][/color] . It is safer to retrieve a value, delete the cache element and then reinsert the value.

The UpdatingCacheEntryFactory does work by modifying the contents of values in place in the cache. This is outside of the core of ehcache and is targeted at high performance CacheEntryFactories for SelfPopulatingCaches.

ehcache 是线程安全的吗?
如果一个频繁修改的表,会涉及到多线程,适合放入ehcache吗?(目前就是因为数据库IO压力过大,才想放入缓存)

ehcache查找时key:ID,那么如果我不是以ID为查询条件的话,是否就没有使用到缓存,
例如:我用电话号码来查询用户,发现缓存似乎没有用到,如何才能解决此问题?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐