缓存,spring
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的更多相关文章
- Redis 缓存 + Spring 的集成示例(转)
<整合 spring 4(包括mvc.context.orm) + mybatis 3 示例>一文简要介绍了最新版本的 Spring MVC.IOC.MyBatis ORM 三者的整合以及 ...
- Redis 缓存 + Spring 的集成示例(转载)
1. 依赖包安装 pom.xml 加入: <dependency> <groupId>org.springframework.data</groupId> < ...
- spring Cache /Redis 缓存 + Spring 的集成示例
spring Cache https://www.ibm.com/developerworks/cn/opensource/os-cn-spring-cache/ spring+redis 缓存 ht ...
- spring boot: 用redis的消息订阅功能更新应用内的caffeine本地缓存(spring boot 2.3.2)
一,为什么要更新caffeine缓存? 1,caffeine缓存的优点和缺点 生产环境中,caffeine缓存是我们在应用中使用的本地缓存, 它的优势在于存在于应用内,访问速度最快,通常都不到1ms就 ...
- spring boot:使用caffeine+redis做二级缓存(spring boot 2.3.1)
一,为什么要使用二级缓存? 我们通常会使用caffeine做本地缓存(或者叫做进程内缓存), 它的优点是速度快,操作方便,缺点是不方便管理,不方便扩展 而通常会使用redis作为分布式缓存, 它的优点 ...
- spring boot:使用spring cache+caffeine做进程内缓存(本地缓存)(spring boot 2.3.1)
一,为什么要使用caffeine做本地缓存? 1,spring boot默认集成的进程内缓存在1.x时代是guava cache 在2.x时代更新成了caffeine, 功能上差别不大,但后者在性能上 ...
- Redis 缓存 + Spring 的集成示例
参考网址:http://blog.csdn.net/defonds/article/details/48716161
- Spring Boot使用redis做数据缓存
1 添加redis支持 在pom.xml中添加 <dependency> <groupId>org.springframework.boot</groupId> & ...
- 基于Spring的Web缓存
缓存的基本思想其实是以空间换时间.我们知道,IO的读写速度相对内存来说是非常比较慢的,通常一个web应用的瓶颈就出现在磁盘IO的读写上.那么,如果我们在内存中建立一个存储区,将数据缓存起来,当浏览器端 ...
- spring使用redis做缓存
缓存 什么是缓存? 在高并发下,为了提高访问的性能,需要将数据库中 一些经常展现和不会频繁变更的数据,存放在存取速率更快的内存中.这样可以 降低数据的获取时间,带来更好的体验 减轻数据库的压力 缓存适 ...
随机推荐
- ExecutorService invokeAll 实例(转)
10个班级,每个班级20名学生,在指定的时间内查询每个班级学生的集合. package cn.com.ld.study.thread; import java.util.ArrayList; impo ...
- Java中间MD5加密算法完整版
携带Java软件开发过程.,因此Java中提供了自带的MessageDigest实现对文本的加密算法,以下是一个对文本进行加密的MD5加密工具类代码演示样例: package net.yuerwan. ...
- LeetCode——Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Foll ...
- hdu 4975 最大流问题解决队伍和矩阵,利用矩阵dp优化
//刚開始乱搞. //网络流求解,假设最大流=全部元素的和则有解:利用残留网络推断是否唯一, //方法有两种,第一种是深搜看看是否存在正边权的环.见上一篇4888 //至少四个点构成的环,另外一种是用 ...
- http://blog.jobbole.com/50603/#comment-153933
http://blog.jobbole.com/50603/#comment-153933
- C++ friend 用法汇总
C++这位朋友同意之类的非公共成员的机制是一个类或函数访问,根据朋友的类型分为三种类型:一般非类成员函数为好友,类成员函数为好友.类为好友. 1 内容朋友 包括报表朋友的朋友以及朋友的定义.明默的感觉 ...
- CreateCompatibleDC工作原理
WindowsGDI的接口没提供这种功能机制.仅仅能是先通过CreateCompatibleDC 创建一个与显示器设备内容兼容的内存设备内容.用SelectObject将位图选入内存设备内容,再用Bi ...
- C++ 在dynamic_cast<>用法
/*这是从网上断开的试样.主要是关于 dynamic_cast<> 用法.*/ /* 行动:对象指向一个基类(或参考)cast一个指向派生类,dynamic_cast将基于一个基类指针确实 ...
- 国外android开源站点
http://android-arsenal.com/
- crawler_phantomjs_windows_linux下demo
1. phantomjs介绍 基于Javascript驱动的命令行webkit引擎,轻量级,安装简单,开发快速,渲染速度较快,无界面的webkit浏览器. phontomjs跟一般浏览器一样可以加载网 ...