ehcache

ehcache 缓存
是专门缓存插件, 可以缓存java 对象, 提供系统性能
1\  MAVEN 导包
2\  ehcache.xml

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../config/ehcache.xsd">


    <diskStore path="java.io.tmpdir" />

    <defaultCache maxElementsInMemory="10000" eternal="false"
        timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true"
        maxElementsOnDisk="10000000" diskPersistent="false"
        diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" />
</ehcache>

3\  spring.xml

<!-- 注册安全管理器对象 -->
<bean name="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
    <!-- 注入realm -->
    <property name="realm" ref="bosRealm"></property>
    <!-- 注入缓存 -->
    <property name="cacheManager" ref="cacheManager"></property>
</bean>

<!-- 注册realm -->
<bean name="bosRealm" class="com.stevezong.bos.realm.BosRealm"></bean>

<!-- 注册ehcache 缓存管理器 -->
<bean name="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
    <!-- 注入ehcache的配置文件 -->
    <property name="cacheManagerConfigFile" value="classpath:conf/ehcache.xml"></property>
</bean>

 

posted on 2018-10-10 10:37  浪漫的偷笑  阅读(105)  评论(0编辑  收藏  举报