|
@@ -9,6 +9,8 @@ public class CacheHelper {
|
|
|
|
|
|
private static RedisClient redisClient;
|
|
|
|
|
|
+ private static CacheObjectTrigger cacheObjectTrigger;
|
|
|
+
|
|
|
private static RedisClient getRedisClient() {
|
|
|
if (null == redisClient) {
|
|
|
redisClient = SpringContextHolder.getBean(RedisClient.class);
|
|
@@ -16,6 +18,13 @@ public class CacheHelper {
|
|
|
return redisClient;
|
|
|
}
|
|
|
|
|
|
+ private static CacheObjectTrigger getCacheObjectTrigger() {
|
|
|
+ if (null == cacheObjectTrigger) {
|
|
|
+ cacheObjectTrigger = SpringContextHolder.getBean(CacheObjectTrigger.class);
|
|
|
+ }
|
|
|
+ return cacheObjectTrigger;
|
|
|
+ }
|
|
|
+
|
|
|
public static AppCacheBean getApp(Long appId) {
|
|
|
String key = "$_APP:" + appId;
|
|
|
return getRedisClient().get(key, AppCacheBean.class);
|
|
@@ -23,7 +32,14 @@ public class CacheHelper {
|
|
|
|
|
|
public static SysPropertyCacheBean getSysProperty(String propKey) {
|
|
|
String key = "$_SYS_PROP:" + propKey;
|
|
|
- return getRedisClient().get(key, SysPropertyCacheBean.class);
|
|
|
+ SysPropertyCacheBean sysPropertyCacheBean = getRedisClient().get(key,
|
|
|
+ SysPropertyCacheBean.class);
|
|
|
+ if (null == sysPropertyCacheBean) {
|
|
|
+ getCacheObjectTrigger().loadSysProperty(propKey);
|
|
|
+ sysPropertyCacheBean = getRedisClient().get(key, SysPropertyCacheBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ return sysPropertyCacheBean;
|
|
|
}
|
|
|
|
|
|
}
|