applicationcontext.xml

xmlns:cache="http://www.springframework.org/schema/cache"

xsi:schemaLocation=http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd

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

<bean id="cache" class="org.springframework.cache.support.SimpleCacheManager">
        <property name="caches">
            <list>
                <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"  p:name="qus"></bean>
                <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"  p:name="clo"></bean>
            </list>
        </property>
    </bean>

业务层

方法上面实现@Cacheable("clo")

例如:

@Cacheable("clo")
    public List<Clothingcategory> cFindAll() {
        return clothingcategoryDAO.findAll();
    }

切记:clo是在bean在配置的,请看上面

缓存,spring的更多相关文章

  1. Redis 缓存 + Spring 的集成示例(转)

    <整合 spring 4(包括mvc.context.orm) + mybatis 3 示例>一文简要介绍了最新版本的 Spring MVC.IOC.MyBatis ORM 三者的整合以及 ...

  2. Redis 缓存 + Spring 的集成示例(转载)

    1. 依赖包安装 pom.xml 加入: <dependency> <groupId>org.springframework.data</groupId> < ...

  3. spring Cache /Redis 缓存 + Spring 的集成示例

    spring Cache https://www.ibm.com/developerworks/cn/opensource/os-cn-spring-cache/ spring+redis 缓存 ht ...

  4. spring boot: 用redis的消息订阅功能更新应用内的caffeine本地缓存(spring boot 2.3.2)

    一,为什么要更新caffeine缓存? 1,caffeine缓存的优点和缺点 生产环境中,caffeine缓存是我们在应用中使用的本地缓存, 它的优势在于存在于应用内,访问速度最快,通常都不到1ms就 ...

  5. spring boot:使用caffeine+redis做二级缓存(spring boot 2.3.1)

    一,为什么要使用二级缓存? 我们通常会使用caffeine做本地缓存(或者叫做进程内缓存), 它的优点是速度快,操作方便,缺点是不方便管理,不方便扩展 而通常会使用redis作为分布式缓存, 它的优点 ...

  6. spring boot:使用spring cache+caffeine做进程内缓存(本地缓存)(spring boot 2.3.1)

    一,为什么要使用caffeine做本地缓存? 1,spring boot默认集成的进程内缓存在1.x时代是guava cache 在2.x时代更新成了caffeine, 功能上差别不大,但后者在性能上 ...

  7. Redis 缓存 + Spring 的集成示例

    参考网址:http://blog.csdn.net/defonds/article/details/48716161

  8. Spring Boot使用redis做数据缓存

    1 添加redis支持 在pom.xml中添加 <dependency> <groupId>org.springframework.boot</groupId> & ...

  9. 基于Spring的Web缓存

    缓存的基本思想其实是以空间换时间.我们知道,IO的读写速度相对内存来说是非常比较慢的,通常一个web应用的瓶颈就出现在磁盘IO的读写上.那么,如果我们在内存中建立一个存储区,将数据缓存起来,当浏览器端 ...

  10. spring使用redis做缓存

    缓存 什么是缓存? 在高并发下,为了提高访问的性能,需要将数据库中 一些经常展现和不会频繁变更的数据,存放在存取速率更快的内存中.这样可以 降低数据的获取时间,带来更好的体验 减轻数据库的压力 缓存适 ...

随机推荐

  1. 你如何破解后安装PS cs6

    至于破解程序猿支持,资源共享是只有更好的,我相信有很多孩子还在用cs5看版本号.假设你想尝试新的版本号PS.但很长一段时间不能找到字的串行数.现在,你如何支付你的序列号和使用永久裂纹PS cs6. 好 ...

  2. 【leetcode】Clone Graph(python)

    类似于二叉树的三种遍历,我们能够基于遍历的模板做非常多额外的事情,图的两种遍历,深度和广度模板相同也能够做非常多额外的事情,这里举例利用深度优先遍历的模板来进行复制,深度优先中,我们先訪问第一个结点, ...

  3. jQuery整理笔记文件夹

    jQuery整理笔记文件夹 jQuery整理笔记一----jQuery開始 jQuery整理笔记二----jQuery选择器整理 jQuery整理笔记三----jQuery过滤函数 jQuery整理笔 ...

  4. express: command not found.

    npm install -g express 可是不行.全局模式不行. With the release of Express 4.0.0 it looks like you need to do s ...

  5. 安装Team Foundation Server 2012过程截图

    原文:安装Team Foundation Server 2012过程截图 专题图 1,下载Team Foundation Server 2012  官方下载: http://www.microsoft ...

  6. String.Split()功能

    我们在过去的教训 String.Join功能(http://blog.csdn.net/zhvsby/archive/2008/11/28/3404704.aspx).当中用到了String.SPli ...

  7. VAXVOIP SDK Licensekey

    Insert the following key to the SDK with SetLicenseKey call: VAXVOIP.COM-191P238P55P253P97P229P51P76 ...

  8. hdu Write a simple HTML Browser

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1088 对比输出 代码: #include <stdio.h> #include <s ...

  9. vim温馨提示

    (一)各种文本操作 各种跳转 h,j,k,l h左移一个字符,j下移一行,k上移一行,l右移一个字符 w.b w 下一个单词,b上一个单词 0,$   行首,行尾 G,gg.30% 3G跳到第3行,g ...

  10. python_基础学习_02_拆分文件(spilt)

    做爬虫经常会有这样的引用场景 ,原始网页存储格式为  url+\t+ html php 有个explode的 拆分文本行方法,比较方便直接接收列值 list($url,$html)=explode(& ...