Avoiding multiple repopulations of the same cache region (due to concurrency)

后端 未结 2 1969
庸人自扰
庸人自扰 2021-02-13 17:07

I have a high traffic website and I use hibernate. I also use ehcache to cache some entities and queries which are required to generate the pages.

The problem is \"paral

2条回答
  •  青春惊慌失措
    2021-02-13 17:41

    The biggest improvement on this issue is that ehcache now (since 2.1) supports the transactional hibernate cache policy. This vastly mitigates the problems described in this issue.

    In order to go a step further (lock threads while accessing the same query cache region) one would need to implement a QueryTranslatorFactory to return custom (extended) QueryTranslatorImpl instances which would inspect query and parameters and block as necessary in the list method. This of course regards the specific use case of query cache using hql which fetch many entities.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题