zoukankan      html  css  js  c++  java
  • spring+mybatis+redis整合后如何动态设置失效时间

     spring+mybatis+redis整合后redis支持设置不同缓存的失效时间,

    看帖子评论找到的方法:帖子地址:http://hbxflihua.iteye.com/blog/2320584

    <!-- 配置RedisCacheManager -->
     <bean id="redisCacheManager" class="org.springframework.data.redis.cache.RedisCacheManager"> 
         <constructor-arg name="redisOperations" ref="redisTemplate" />
      <property name="defaultExpiration" value="${redis.expiration}"/>
            <property name="expires"> 
                <util:map> 
                    <entry value="180" key="selectUserById"/> 
                    <entry value="180000" key="menuByUrl"/> 
                </util:map> 
            </property> 
     </bean>

    需要引用:

    <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:aop="http://www.springframework.org/schema/aop" 
        xmlns:util="http://www.springframework.org/schema/util" 
        xsi:schemaLocation="http://www.springframework.org/schema/beans   
               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd   
               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/context   
               http://www.springframework.org/schema/context/spring-context-3.0.xsd
               http://www.springframework.org/schema/util 
               http://www.springframework.org/schema/util/spring-util-3.0.xsd
               "> 

  • 相关阅读:
    动态规划-石子问题
    动态规划-最长不下降子序列
    STL 二分查找
    动态规划-最长公共子序列与最长公共子串
    动态规划-背包问题
    高精度运算模板学习
    二叉树 | 根据前序、后序生成中序
    03.动画
    02.绘制函数
    01.hello world
  • 原文地址:https://www.cnblogs.com/zypu/p/6593820.html
Copyright © 2011-2022 走看看