【问题标题】:Is putting @Cacheable or @Cache above the Entity enough for Hibernate to start caching?将@Cacheable 或@Cache 放在实体上方是否足以让Hibernate 开始缓存?
【发布时间】:2021-10-12 01:17:11
【问题描述】:

足够了吗,Hibernate 会自动检查正在处理该实体的方法并更新缓存? 或者@Cacheable、@CachePut、@CacheEvict 以上方法的注解对于工作缓存是必需的。

【问题讨论】:

    标签: spring spring-boot hibernate caching hibernate-cache


    【解决方案1】:

    缓存的内容取决于配置。如果启用选择性缓存,则需要使用 @Cacheable 注释所有应缓存的实体。对于查询,您还需要提供缓存提示,但所有这些都可以在官方文档中阅读:https://docs.jboss.org/hibernate/orm/5.5/userguide/html_single/Hibernate_User_Guide.html#caching

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-08
      • 2019-06-22
      • 2011-04-09
      • 1970-01-01
      • 1970-01-01
      • 2011-06-24
      • 2020-03-03
      • 1970-01-01
      相关资源
      最近更新 更多