Spring Cache抽象不支持阻塞缓存,这意味着一个缓存,当您在多个线程上同时对同一个键执行读取操作时,可缓存的方法只会被调用一次。 Guava缓存支持使用LoadingCache开箱即用的功能。 Spring是否计划引入一个可以与guava缓存一起使用的单独的阻塞缓存抽象层? 在某些情况下,对于一个键只调用一次可缓存的方法是很重要的,所以我认为它是一个很好的功能。
答案 0 :(得分:1)
Check SPR-9254.
While I agree that it looks like a good feature, this definitely involves locking and overhead to make it work properly. Of course, you don't have to worry about that low-level stuff since it is handled at the library level. But that doesn't mean nothing potentially nasty is happening behind the scenes.
Anyway, that issue should give you enough context of where we stands.
(By the way, no need to create several SO thread for the same issue).