EhCache HelloWorld实现

EhCache最新版本是3.X 本人一直用的是2.X 比较稳定 功能足够用;

所以还是用2.X版本;

这里,我们新建一个Maven项目,

pom.xml里引入 ehcache支持;

EhCache HelloWorld实现

ehcache.xml配置文件

EhCache HelloWorld实现

我们再新建一个测试类:

EhCache HelloWorld实现

运行输出:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[ key = 小霸王, value=牛逼, version=1, hitCount=1, CreationTime = 1517543753204, LastAccessTime = 1517543753208 ]
牛逼

目录结构:

EhCache HelloWorld实现