spring配置redis
<?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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="300"/> <!-- 控制一个pool可分配多少个jedis实例 -->
<property name="maxIdle" value="100" /> <!-- 控制一个pool最多有多少个状态为idle(空闲)的jedis实例 -->
<property name="maxWaitMillis" value="2000" /> <!-- 表示当borrow一个jedis实例时,最大的等待时间,如果超过等待时间,则直接抛出JedisConnectionException -->
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="true"/>
</bean>
<!-- redis的连接池pool,不是必选项:timeout/password -->
<bean id="jedisConnectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="hostName" value="${redis.host}" />
<property name="port" value="${redis.port}" />
<property name="password" value="${redis.passWord}" />
<property name="poolConfig" ref="jedisPoolConfig" />
</bean>
<bean id="stringRedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory">
<ref bean="jedisConnectionFactory" />
</property>
</bean>
<!-- 配置springRedis -->
<bean id="springRedis" class="com.inborn.inshop.common.redis.SpringRedis">
<property name="redisKeyPrefix" value="${redis.key.prefix}" />
<property name="stringRedisTemplate">
<ref bean="stringRedisTemplate" />
</property>
</bean>
</beans>
spring配置redis的更多相关文章
- Spring配置redis及使用
一.redis简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库 Redis支持数据的持久化,可以将内存中的数据保存在磁盘中,重启的时候可以再次加载进行使用. ...
- spring配置redis注解缓存
前几天在spring整合Redis的时候使用了手动的方式,也就是可以手动的向redis添加缓存与清除缓存,参考:http://www.cnblogs.com/qlqwjy/p/8562703.html ...
- spring 配置 redis
1.maven相关pom.xml <dependencies> <!--spring redis--> <dependency> <groupId>or ...
- spring配置redis(xml+java方式)(最底层)
条件:引用好架包 <dependency> <groupId>org.springframework.data</groupId> <artifactId&g ...
- spring mvc Spring Data Redis RedisTemplate [转]
http://maven.springframework.org/release/org/springframework/data/spring-data-redis/(spring-data包下载) ...
- Spring Data Redis简介以及项目Demo,RedisTemplate和 Serializer详解
一.概念简介: Redis: Redis是一款开源的Key-Value数据库,运行在内存中,由ANSI C编写,详细的信息在Redis官网上面有,因为我自己通过google等各种渠道去学习Redis, ...
- spring使用redis做缓存
缓存 什么是缓存? 在高并发下,为了提高访问的性能,需要将数据库中 一些经常展现和不会频繁变更的数据,存放在存取速率更快的内存中.这样可以 降低数据的获取时间,带来更好的体验 减轻数据库的压力 缓存适 ...
- Spring下redis的配置
这个项目用到redis,所以学了一下怎样在Spring框架下配置redis. 1.首先是在web.xml中添加Spring的配置文件. <web-app version="3.0&qu ...
- spring集成redis——主从配置以及哨兵监控
Redis主从模式配置: Redis的主从模式配置是非常简单的,首先我们需要有2个可运行的redis环境: master node : 192.168.56.101 8887 slave node: ...
随机推荐
- Java国际化号码验证方法,国内手机号正则表达式
Java国际化号码验证方法,国内手机号正则表达式 中国电信号段 133.149.153.173.177.180.181.189.199 中国联通号段 130.131.132.145.155.156.1 ...
- golang学习笔记6 beego项目路由设置
golang学习笔记5 beego项目路由设置 前面我们已经创建了 beego 项目,而且我们也看到它已经运行起来了,那么是如何运行起来的呢?让我们从入口文件先分析起来吧: package main ...
- Chrome插件消息传递实例
首先吐槽"360极速浏览器应用开发平台"的开发文档,在消息传递(http://open.chrome.360.cn/extension_dev/messaging.html)一节中 ...
- centos 安装arcgis server 10.1
1.创建新用户,不要在root下面直接安装 [root@localhost ~]# groupadd esri //创建esri组 [root@localhost ~]# useradd ags -g ...
- EDK II之驱动程序与硬件平台的初始化简介
本文旨在简单介绍一下UEFI中驱动程序的加载方式(这里涉及的模块指的是符合UEFI Driver Model的模块): 在UEFI中,当一个驱动模块被加载时,在模块入口点只会安装EFI_DRIVER_ ...
- script 跳出小窗口
sss
- Tensorflow学习笔记01
Tensorflow官方网站:http://tensorflow.org/ 极客学院Tensorflow中文版:http://wiki.jikexueyuan.com/project/tensorfl ...
- 作为phper既然了解共享内存函数shmop的使用方法,那么就必须要了解一下信号量是什么,以及信号量使用的代码案例
在单独的一个PHP进程中读写.创建.删除共享内存方面上你应该没有问题了.但是实际运行中不可能只是一个PHP进程在运行中.如果在多个进程的情况下你还是沿用单个进程的处理方法,你一定会碰到问题--著名的并 ...
- css列表list、表格table
列表list,无序列表ul,有序列表ol 1.列表项样式list-style-type 无列表默认为dist实心圆,有序列表默认为decimal阿拉伯数字(前面不带0) 其他无序列表常用none无样式 ...
- oracle 11g中的自动维护任务管理
因为人员紧缺,最近又忙着去搞性能优化的事情,有时候真的是不想再搞这个事情,只是没办法,我当前的绩效几乎取决于这个项目的最终成绩,所以不管是人的事还是事的事,都得去让他顺利推进. 前段时间发生还有几台服 ...