Ehcache 1.5.0 User Guide - Cache Configuration 缓存配置(1)
(Ehcache 1.5.0 用户指南)
E_mail:jianglike18@163.con
Blog: http://blog.csdn.net/jianglike18
qq:29396597
6、Cache Configuration (缓存配置)
Caches can be configured in ehcache either declaratively, in xml, or by creating them programmatically and specifying their parameters in the constructor.
While both approaches are fully supported it is generally a good idea to separate the cache configuration from runtime use. There are also these benefits:
- It is easy if you have all of your configuration in one place. Caches consume memory, and disk space. They need to be carefully tuned. You can see the total effect in a configuration file. You could do this code, but it would not as visible.
- Cache configuration can be changed at deployment time.
- Configuration errors can be checked for at start-up, rather than causing a runtime error.
(在ehcache中,缓存可以在xml中配置,或者由程序创建并在构造函数中设置他们的参数 。
虽然两种方法都完全支持,但是将缓存的配置和运行时使用分开一般比较好,有如下好处:
l 如果让你所有的配置在一个地方比较方便。缓存消耗内存和磁盘空间。他们需要仔细调整。在配置文件中你可以看到的总体影响。用代码你可以做到这一点,但它不会成为可见。
l 缓存的配置可以在部署的时候更改。
l