search

Home  >  Q&A  >  body text

java - hibernate有一级和二级缓存为什么还要使用ehcache缓存?

目前已经了解hibernate一级缓存基于session的,二级缓存基于sessionFactory的可以配置是否启用。两者提供的方法也是差不多,有查询会先找一级缓存,再找二级缓存,之后去数据库。
好像有些项目是用了hibernate的缓存,为什么还要使用ehcache缓存技术?

PHPzPHPz2822 days ago703

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:38:34

    There are many options for hibernate's second-level cache. ehcache is the default implementation. You can use other options. Just implement the CacheProvider interface.

    reply
    0
  • PHPz

    PHPz2017-04-18 09:38:34

    hibernate's second-level cache only needs to implement its interface, and you can customize it.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:38:34

    ehcache is one of the implementation solutions of hibernate second-level cache

    reply
    0
  • Cancelreply