zoukankan      html  css  js  c++  java
  • Springboot 集成 Redis

    @CachePut 和 @Cacheable 区别

    操作步骤如下:

    1. t1 t2 都为空值

    @CachePut("t1")
    public String getData1(){
        return service.getData1();    
    }
    
    @Cacheable("t2")
    public String getData1(){
        return service.getData2();    
    }
    

    此时 t1 = "hello 1";
    此时 t2 = "hello 2";

    2. 修改返回值

    service.getData1() = "hello 1-1";
    service.getData2() = "hello 2-2";

    此时 t1 = "hello 1-1";
    此时 t2 = "hello 2"

    结论:@CachePut 数据会更新,@Cacheable 数据不会更新

  • 相关阅读:
    datagrid
    SQL语句
    JavaScript事件
    DOM和BOM
    JavaScript基础知识
    css
    网络编程常识
    集合框架
    多线程常识
    面向对象常识
  • 原文地址:https://www.cnblogs.com/mengjianzhou/p/13187527.html
Copyright © 2011-2022 走看看