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
               "> 

  • 相关阅读:
    JavaScript向input标签的value赋值
    thinkphp关于本地引用图片
    jquery中得到input的值
    HTML的video标签,不能下载视频代码
    PHP数据库类
    MySQL数据库之MyISAM与InnoDB的区别
    php函数ob_start(),解决header输出头报错问题
    eps图片中文乱码问题
    感悟----程序员需要养成的习惯
    <前m大的数>的妙解
  • 原文地址:https://www.cnblogs.com/zypu/p/6593820.html
Copyright © 2011-2022 走看看