Can same Ehcache object of same CacheManager be used by multiple threads?

被刻印的时光 ゝ 提交于 2019-12-09 06:52:27

First of all, a cache is not a store. So you can't expect a cache to return the latest data all the time. For different reasons, it might return null.

Right now, unless some eviction or expiration occurs, the data should be there. So I will need a full example to tell you what's going on.

My first question would be: Why do you clear and put? Why not only put? And do we agree that clear will clear all entries? You only have one entry in your cache?

I'm only seeing now that the first thread also starts with a get, so does that mean that the mapping is installed always? If so, are you sure the other threads are actually using the same Cache instance?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!