• spring cache


    spring-ehcache.xml文件内容如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:cache="http://www.springframework.org/schema/cache"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/cache
    http://www.springframework.org/schema/cache/spring-cache-4.0.xsd">

    <cache:annotation-driven cache-manager="cacheManager"/>

    <bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    <property name="configLocation" value="classpath:ehcache.xml" />
    </bean>

    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
    <property name="cacheManager" ref="cacheManagerFactory"/>
    </bean>

    </beans>

    ehcache.xml文件内容如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">


    <!-- 默认缓存 -->
    <defaultCache
    maxElementsInMemory="7000"
    eternal="false"
    timeToIdleSeconds="120"
    timeToLiveSeconds="120"
    overflowToDisk="false"/>

    <!-- 交易数据缓存 FIFO 先进先策略-->
    <cache name="tradeDataCache"
    maxElementsInMemory="7000"
    eternal="false"
    timeToIdleSeconds="120"
    timeToLiveSeconds="120"
    overflowToDisk="false"
    memoryStoreEvictionPolicy="FIFO"/>
    </ehcache>

  • 相关阅读:
    重排序
    线程的生命周期状态
    并发的有序性
    并发的可见性
    并发的原子性
    Java内存模型
    缓存一致性协议MESI
    lsof
    nmap
    elastcisearch简介
  • 原文地址:https://www.cnblogs.com/man-li/p/4476201.html
Copyright © 2020-2023  润新知