zoukankan      html  css  js  c++  java
  • 实战 -- Redis2.4.2集成spring3.2.2

    redis.host=192.168.1.237
    redis.port=6379
    redis.pass=
    redis.timeout=100000
    #最大能够保持idel状态的对象数 
    redis.maxIdle=300
    #最大分配的对象数    
    redis.maxTotal=600
    #多长时间检查一次连接池中空闲的连接 
    redis.timeBetweenEvictionRunsMillis=30000  
    #空闲连接多长时间后会被收回 
    redis.minEvictableIdleTimeMillis=30000 
    #当调用borrow Object方法时,是否进行有效性检查   
    redis.testOnBorrow=true
    ########reids编码格式 
    redis.encode=utf-8
    ######缓存过期时间 秒  1000*60*60*24*7 七天 
    redis.expire=604800000
    ####是否开启Redis服务应用 
    redis.unlock=false
    <context:property-placeholder location="classpath:conf/redis.properties" /> 
     <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">    
      <property name="maxTotal"  value="${redis.maxTotal}" /> 
         <property name="maxIdle" value="${redis.maxIdle}" /> 
         <property name="timeBetweenEvictionRunsMillis" value="${redis.timeBetweenEvictionRunsMillis}" />
            <property name="minEvictableIdleTimeMillis" value="${redis.minEvictableIdleTimeMillis}" />
            <property name="testOnBorrow" value="${redis.testOnBorrow}" />
     </bean>
      
     <bean id="jedisPool" class="redis.clients.jedis.JedisPool" destroy-method="destroy">
      <constructor-arg ref="jedisPoolConfig" />
      <constructor-arg value="${redis.host}" />
      <constructor-arg type="int" value="${redis.port}" />
     </bean>
      
     <bean id="jedisConnFactory" 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.pass}"/>
      <property name="timeout"  value="${redis.timeout}" />
      <property name="poolConfig"  ref="jedisPoolConfig" />
      <property name="usePool"  value="true" />
     </bean>
      
     <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
      <property name="connectionFactory" ref="jedisConnFactory"/>
     </bean>
  • 相关阅读:
    Java设计模式-装饰器模式
    【c++内存分布系列】单独一个类
    【转】LCS
    快速排序
    冒泡排序
    选择排序
    多线程读取全局变量
    【转】一致性hash算法(consistent hashing)
    【转】五笔的字典序编码与解码
    给定一个函数rand()能产生0到n-1之间的等概率随机数,问如何产生0到m-1之间等概率的随机数?
  • 原文地址:https://www.cnblogs.com/damowang/p/4451652.html
Copyright © 2011-2022 走看看