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

  • 相关阅读:
    VC 透明滑动控件Slider Control
    VC 对话框背景颜色、控件颜色
    VS2008下直接安装使用Boost库1.46.1版本
    强大的CImage类
    用CImage类来显示PNG、JPG等图片
    VS2008+Qt 项目目录
    java 中几种常用数据结构
    数据结构与算法——常用数据结构及其Java实现
    C++常用数据结构的实现
    基础数据结构和算法概念
  • 原文地址:https://www.cnblogs.com/zypu/p/6593820.html
Copyright © 2011-2022 走看看