java缓存详解[借鉴].pdfVIP

  • 3
  • 0
  • 约1.3万字
  • 约 8页
  • 2021-10-17 发布于福建
  • 举报
Ehcache 中不仅可以用配置文件来配置缓存,而在代码中也可以实现同样的功能。 CacheManager singletonManager = CacheManager.create(); Cache memoryOnlyCache = new Cache( “testCache ”,50000, false, false, 8, 2); Cache test = singletonManager.getCache( “testCache ”); 删除只需要调用 singletonManager.removeCache( “testCache ”); Shotdown CacheManager 在使用完 Ehcache 后,必须要 shutdown 缓存。 Ehcache 中有自己的关闭机制,不过最好在你的代码中显 示调用 CacheManager.getInstance().shutdown(); 1.EhCache 是什么 EhCache 是 Hibernate 的二级缓存技术之一, 可以把查询出来的数据存储在内存或者磁盘, 节省下次同 样查询语句再次查询数据库,大幅减轻数据库压力; 2.EhCache 的使用注意点 当用 Hi

文档评论(0)

1亿VIP精品文档

相关文档