缓存工具类使用

This commit is contained in:
b2baccline
2020-03-27 22:12:48 +08:00
parent 3883e9e7fc
commit 4dd703d132
4 changed files with 39 additions and 3 deletions

View File

@@ -21,6 +21,6 @@ public final class SecurityConst {
/**
* 缓存 oauth 相关前缀
*/
public static final String BALLCAT_OAUTH_PREFIX = "ball-cat:oauth:";
public static final String OAUTH_PREFIX = "oauth:";
}

View File

@@ -0,0 +1,36 @@
package com.your.packages.admin.modules;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Hccake
* @version 1.0
* @date 2020/3/25 23:45
*/
@RestController
@RequestMapping("/public/test")
public class CacheTestController {
@GetMapping("1")
// @Cached(key = "testKey1")
public String test1(){
return "ceshi1";
}
@GetMapping("2")
//@CachePut(key = "testKey1")
public String test2(){
return "ceshi2";
}
@GetMapping("3")
// @CacheDel(key = "testKey1")
public void test3(){
System.out.println("test3");
}
}

View File

@@ -99,7 +99,7 @@ public class CustomAuthorizationServerConfigurer implements AuthorizationServerC
@Bean
public TokenStore tokenStore() {
RedisTokenStore tokenStore = new RedisTokenStore(redisConnectionFactory);
tokenStore.setPrefix(SecurityConst.BALLCAT_OAUTH_PREFIX);
tokenStore.setPrefix(SecurityConst.OAUTH_PREFIX);
return tokenStore;
}

View File

@@ -13,7 +13,7 @@
<hutool.version>5.0.1</hutool.version>
<mybatis-plus.version>3.3.0</mybatis-plus.version>
<simple-cache.version>0.0.4</simple-cache.version>
<simple-cache.version>1.0.0</simple-cache.version>
<swagger.core.version>1.5.2</swagger.core.version>
<xxl-job.version>2.1.0</xxl-job.version>
<spring-boot-admin.version>2.2.0</spring-boot-admin.version>