zoukankan      html  css  js  c++  java
  • spring缓存Ehcache(入门2)源码解读

    Ehcache缓存:

        解读:

    Ehcache缓存是在继承spring缓存核心类CacheManager的基础上实现的。

        常用类:

    EhCacheCacheManager:继承自CacheManager类(org.springframework.cache.CacheManager)负责管理Cache对象。
    EhCacheManagerFactoryBean:是个工厂类,根据配置文件中设置的参数(配置文件会被注入工厂类对象中),新建Ehcache的CacheManager对象,其可以通过属性configLocation指定用于创建CacheManager的Ehcache配置文件的路径,通常是ehcache.xml文件的路径。

    实例:

    ------------------------------------------------------------------------------------------------------------

    <!--缓存配置-->

       <!--启用缓存注解功能-->

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

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

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

    ------------------------------------------------------------------------------------------------------------

    service层的使用可以翻看http://www.cnblogs.com/zqsky/p/5868549.html。

  • 相关阅读:
    BIO与NIO、AIO的区别
    Java虚拟机
    PV模型
    HashMap、HashSet源代码分析其 Hash 存储机制
    单节点到分布式集群
    Oracle表分区
    ZooKeeper原理
    oracle中的 exists 和 in 的效率问题
    OQL对象查询语言
    keepalived openssl 报错
  • 原文地址:https://www.cnblogs.com/zqsky/p/5882752.html
Copyright © 2011-2022 走看看