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

  • 相关阅读:
    数论学习笔记之欧拉函数
    [CQOI2014]危桥
    lspci -nnk
    linux 详解useradd 命令基本用法
    。 (有些情况下通过 lsof(8) 或 fuser(1) 可以 找到有关使用该设备的进程的有用信息)
    CentOS 7 设置默认进入字符界面
    下面附上top和sar的使用方法,方便参考! "top"工具
    Centos7/RHEL7 开启kdump
    Linux内存带宽的一些测试笔记
    调试测试
  • 原文地址:https://www.cnblogs.com/zypu/p/6593820.html
Copyright © 2011-2022 走看看