ans = new HashSet<>();
+ for (byte[] b : sets) {
+ ans.add(new String(b));
+ }
+ return ans;
+ });
+
+ res.put("keys", keys);
+ return res;
}
@GetMapping(path = "self")
diff --git a/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/BasicDemo.java b/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/BasicDemo.java
index 2875b798..9a6d9b50 100644
--- a/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/BasicDemo.java
+++ b/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/BasicDemo.java
@@ -29,7 +29,7 @@ public String sayHello(String name) {
}
/**
- * 时效缓存
+ * 失效缓存
*
* @param name
* @return
diff --git a/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/ExtendDemo.java b/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/ExtendDemo.java
index da5cac45..bf901bd9 100644
--- a/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/ExtendDemo.java
+++ b/spring-boot/125-cache-ano/src/main/java/com/git/hui/boot/cache/ano/server/ExtendDemo.java
@@ -7,6 +7,7 @@
import org.springframework.stereotype.Service;
import java.lang.reflect.Method;
+import java.util.Map;
import java.util.UUID;
/**
@@ -17,17 +18,49 @@
public class ExtendDemo {
/**
- * 对应的key为: vv::id
+ * 没有指定key时,采用默认策略 {@link org.springframework.cache.interceptor.SimpleKeyGenerator } 生成key
+ *
+ * 对应的key为: k1::id
+ * value --> 等同于 cacheNames
* @param id
* @return
*/
- @Cacheable(value = "vv")
- public String key(int id) {
- return "defaultKey:" + id + " --> " + UUID.randomUUID().toString();
+ @Cacheable(value = "k1")
+ public String key1(int id) {
+ return "defaultKey:" + id;
}
/**
- * 对应的redisKey 为: get vv::ExtendDemo#selfKey([id])
+ * redis_key : k2::SimpleKey[]
+ *
+ * @return
+ */
+ @Cacheable(value = "k0")
+ public String key0() {
+ return "key0";
+ }
+
+ /**
+ * redis_key : k2::SimpleKey[id,id2]
+ *
+ * @param id
+ * @param id2
+ * @return
+ */
+ @Cacheable(value = "k2")
+ public String key2(Integer id, Integer id2) {
+ return "key1" + id + "_" + id2;
+ }
+
+
+ @Cacheable(value = "k3")
+ public String key3(Map map) {
+ return "key3" + map;
+ }
+
+ /**
+ * 对应的redisKey 为: get vv::ExtendDemo#selfKey([id])
+ *
* @param id
* @return
*/