shiro缓存

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_38087648/article/details/80080732

缓存jar包

    <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-ehcache</artifactId>
            <version>1.2.3</version>
        </dependency>

shiro缓存的配置文件

  <!-- 缓存管理器 -->
  <bean id="cacheManager" class ="org.apache.shiro.cache.ehcache.EhCacheManager"> 
    <property name ="cacheManagerConfigFile" value ="classpath:shiro-ehcache.xml"/>
  </bean>
<!-- securityManager -->
    <bean id ="securityManager" class ="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
        <property name ="realm" ref ="customRealm" />
        <property name ="cacheManager" ref ="cacheManager" />
        <property name ="sessionManager" ref ="sessionManager"/>
    </bean>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../config/ehcache.xsd">
    <diskStore path="F:\develop\ehcache" />
    <defaultCache 
    maxElementsInMemory="1000"
    maxElementsOnDisk="10000000"
    eternal="false"
    overflowToDisk="false"
    diskPersistent="false"
    timeToIdleSeconds="120"
    timeToLiveSeconds="120"
    diskExpiryThreadIntervalSeconds="120"
    memoryStoreEvictionPolicy="LRU"
    >
    </defaultCache> 
</ehcache>

猜你喜欢

转载自blog.csdn.net/qq_38087648/article/details/80080732