-
大小: 7.91MB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-10-09
- 語言: 其他
- 標簽:
資源簡介
SSO 單點登錄系統(tǒng) +源碼 +部署文檔+架構(gòu)圖+權(quán)限管,包含項目數(shù)據(jù)庫

代碼片段和文件信息
package?com.smart.mvc.cache;
import?java.util.List;
import?java.util.Set;
import?java.util.concurrent.TimeUnit;
import?org.slf4j.Logger;
import?org.slf4j.LoggerFactory;
import?org.springframework.data.redis.core.HashOperations;
import?org.springframework.data.redis.core.ListOperations;
import?org.springframework.data.redis.core.RedisTemplate;
import?org.springframework.data.redis.core.SetOperations;
import?com.smart.mvc.exception.CacheException;
public?class?RedisCache?{
private?static?final?Logger?LOGGER?=?LoggerFactory.getLogger(RedisCache.class);
private?RedisTemplate?redisTemplate;
public?static?final?String?KEY_SET_PREFIX?=?“_set:“;
public?static?final?String?KEY_LIST_PREFIX?=?“_list:“;
public?T?get(String?key)?{
LOGGER.debug(“get?key?[{}]“?key);
try?{
if?(key?==?null)?{
return?null;
}
else?{
return?redisTemplate.opsForValue().get(key);
}
}
catch?(Throwable?t)?{
LOGGER.error(“get?key?[{}]?exception!“?key?t);
throw?new?CacheException(t);
}
}
public?T?set(String?key?T?value)?{
LOGGER.debug(“set?key?[{}]“?key);
try?{
redisTemplate.opsForValue().set(key?value);
return?value;
}
catch?(Throwable?t)?{
LOGGER.error(“set?key?[{}]?exception!“?key?t);
throw?new?CacheException(t);
}
}
public?T?set(String?key?T?value?long?timeout)?{
LOGGER.debug(“set?key?[{}]“?key);
try?{
redisTemplate.opsForValue().set(key?value?timeout?TimeUnit.MINUTES);
return?value;
}
catch?(Throwable?t)?{
LOGGER.error(“set?key?[{}]?exception!“?key?t);
throw?new?CacheException(t);
}
}
public?void?delete(String?key)?{
LOGGER.debug(“delete?key?[{}]“?key);
try?{
redisTemplate.delete(key);
}
catch?(Throwable?t)?{
LOGGER.error(“delete?key?[{}]?exception!“?key?t);
throw?new?CacheException(t);
}
}
@SuppressWarnings(“unchecked“)
public?void?setSet(String?k?T?value?long?time)?{
String?key?=?KEY_SET_PREFIX?+?k;
LOGGER.debug(“setSet?key?[{}]“?key);
try?{
SetOperations?valueOps?=?redisTemplate.opsForSet();
valueOps.add(key?value);
if?(time?>?0)
redisTemplate.expire(key?time?TimeUnit.SECONDS);
}
catch?(Throwable?t)?{
LOGGER.error(“setSet?key?[{}]?exception!“?key?t);
throw?new?CacheException(t);
}
}
public?void?setSet(String?k?T?value)?{
setSet(k?value?-1);
}
@SuppressWarnings(“unchecked“)
public?void?setSet(String?k?Set?v?long?time)?{
String?key?=?KEY_SET_PREFIX?+?k;
LOGGER.debug(“setSet?key?[{}]“?key);
try?{
SetOperations?setOps?=?redisTemplate.opsForSet();
setOps.add(key?(T[])?v.toArray());
if?(time?>?0)
redisTemplate.expire(key?time?TimeUnit.SECONDS);
}
catch?(Throwable?t)?{
LOGGER.error(“setSet?key?[{}]?exception!“?key?t);
throw?new?CacheException(t);
}
}
public?void?setSet(String?k?Set?v)?{
setSet(k?v
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-08-11?01:33??smart-master\
?????文件??????????88??2017-08-11?01:33??smart-master\.gitattributes
?????文件?????????106??2017-08-11?01:33??smart-master\.gitignore
?????文件????????6474??2017-08-11?01:33??smart-master\README.md
?????文件???????13867??2017-08-11?01:33??smart-master\pom.xm
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\deploy\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\deploy\dev\
?????文件?????????399??2017-08-11?01:33??smart-master\smart-mvc\deploy\dev\service.properties
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\deploy\pro\
?????文件?????????399??2017-08-11?01:33??smart-master\smart-mvc\deploy\pro\service.properties
?????文件????????4683??2017-08-11?01:33??smart-master\smart-mvc\pom.xm
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\cache\
?????文件????????6259??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\cache\RedisCache.java
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\captcha\
?????文件????????2804??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\captcha\Captcha.java
?????文件?????????496??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\captcha\CaptchaException.java
?????文件????????1269??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\captcha\CaptchaFilter.java
?????文件????????1157??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\captcha\CaptchaHelper.java
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\config\
?????文件?????????756??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\config\ConfigUtils.java
?????文件????????2102??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\config\DynamicPropertyPlaceholderConfigurer.java
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\controller\
?????文件????????1436??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\controller\ba
?????目錄???????????0??2017-08-11?01:33??smart-master\smart-mvc\src\main\java\com\smart\mvc\dao\
............此處省略806個文件信息
評論
共有 條評論