WANG 6 سال پیش
والد
کامیت
5099d505ba

+ 23 - 0
src/main/java/cn/com/qmth/examcloud/support/cache/CacheHelper.java

@@ -0,0 +1,23 @@
+package cn.com.qmth.examcloud.support.cache;
+
+import cn.com.qmth.examcloud.support.cache.bean.AppCacheBean;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
+import cn.com.qmth.examcloud.web.support.SpringContextHolder;
+
+public class CacheHelper {
+
+	private static RedisClient redisClient;
+
+	private static RedisClient getRedisClient() {
+		if (null == redisClient) {
+			redisClient = SpringContextHolder.getBean(RedisClient.class);
+		}
+		return redisClient;
+	}
+
+	public static AppCacheBean getApp(Long appId) {
+		String key = "$_APP:" + appId;
+		return getRedisClient().get(key, AppCacheBean.class);
+	}
+
+}

+ 67 - 0
src/main/java/cn/com/qmth/examcloud/support/cache/bean/AppCacheBean.java

@@ -0,0 +1,67 @@
+package cn.com.qmth.examcloud.support.cache.bean;
+
+public class AppCacheBean {
+
+	private Long id;
+
+	/**
+	 * APP服务名(大写字母加"-"组成)
+	 */
+	private String name;
+
+	/**
+	 * APP编码(通常为1到3位大写字母和数字组合)
+	 */
+	private String code;
+
+	/**
+	 * 密钥
+	 */
+	private String secretKey;
+
+	/**
+	 * 接口鉴权时差范围
+	 */
+	private Long timeRange;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getSecretKey() {
+		return secretKey;
+	}
+
+	public void setSecretKey(String secretKey) {
+		this.secretKey = secretKey;
+	}
+
+	public Long getTimeRange() {
+		return timeRange;
+	}
+
+	public void setTimeRange(Long timeRange) {
+		this.timeRange = timeRange;
+	}
+
+}