From 80b6cbfc9c861469146318d0b3dd5f8b8b525b8a Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期五, 01 十一月 2024 15:11:19 +0800
Subject: [PATCH] Revert "集成获取mdm分发通用数据格式接口集成"

---
 Source/BladeX-Tool/blade-starter-social/src/main/java/org/springblade/core/social/cache/AuthStateRedisCache.java |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/Source/BladeX-Tool/blade-starter-social/src/main/java/org/springblade/core/social/cache/AuthStateRedisCache.java b/Source/BladeX-Tool/blade-starter-social/src/main/java/org/springblade/core/social/cache/AuthStateRedisCache.java
new file mode 100644
index 0000000..82abc72
--- /dev/null
+++ b/Source/BladeX-Tool/blade-starter-social/src/main/java/org/springblade/core/social/cache/AuthStateRedisCache.java
@@ -0,0 +1,69 @@
+package org.springblade.core.social.cache;
+
+import lombok.AllArgsConstructor;
+import me.zhyd.oauth.cache.AuthCacheConfig;
+import me.zhyd.oauth.cache.AuthStateCache;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 鎵╁睍Redis鐗堢殑state缂撳瓨
+ *
+ * @author yadong.zhang, Chill
+ */
+@AllArgsConstructor
+public class AuthStateRedisCache implements AuthStateCache {
+
+	private final RedisTemplate<String, Object> redisTemplate;
+
+	private final ValueOperations<String, Object> valueOperations;
+
+
+	/**
+	 * 瀛樺叆缂撳瓨锛岄粯璁�3鍒嗛挓
+	 *
+	 * @param key   缂撳瓨key
+	 * @param value 缂撳瓨鍐呭
+	 */
+	@Override
+	public void cache(String key, String value) {
+		valueOperations.set(key, value, AuthCacheConfig.timeout, TimeUnit.MILLISECONDS);
+	}
+
+	/**
+	 * 瀛樺叆缂撳瓨
+	 *
+	 * @param key     缂撳瓨key
+	 * @param value   缂撳瓨鍐呭
+	 * @param timeout 鎸囧畾缂撳瓨杩囨湡鏃堕棿锛堟绉掞級
+	 */
+	@Override
+	public void cache(String key, String value, long timeout) {
+		valueOperations.set(key, value, timeout, TimeUnit.MILLISECONDS);
+	}
+
+	/**
+	 * 鑾峰彇缂撳瓨鍐呭
+	 *
+	 * @param key 缂撳瓨key
+	 * @return 缂撳瓨鍐呭
+	 */
+	@Override
+	public String get(String key) {
+		return String.valueOf(valueOperations.get(key));
+	}
+
+	/**
+	 * 鏄惁瀛樺湪key锛屽鏋滃搴攌ey鐨剉alue鍊煎凡杩囨湡锛屼篃杩斿洖false
+	 *
+	 * @param key 缂撳瓨key
+	 * @return true锛氬瓨鍦╧ey锛屽苟涓攙alue娌¤繃鏈燂紱false锛歬ey涓嶅瓨鍦ㄦ垨鑰呭凡杩囨湡
+	 */
+	@Override
+	public boolean containsKey(String key) {
+		return redisTemplate.hasKey(key);
+	}
+
+}

--
Gitblit v1.9.3