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。

  • 相关阅读:
    tableView
    ios设计模式 设计一个应用程序 笔记
    Touching the Background to close the Keyboard
    fdfd
    fdffafadf
    Declaring the Action Method
    网易公开课IOS笔记 第二课
    getters and setters
    objective c
    Google编码规范 C++ Style Guide, JavaScript Style Guide, ObjectiveC Style Guide, and Python Style Guide
  • 原文地址:https://www.cnblogs.com/zqsky/p/5882752.html
Copyright © 2011-2022 走看看