最新代码

This commit is contained in:
admin
2024-05-06 10:20:46 +08:00
parent a0cd0312a5
commit 2919029b81
126 changed files with 5276 additions and 1137 deletions

View File

@@ -1,5 +1,6 @@
package com.starry.common.redis;
import org.springframework.dao.QueryTimeoutException;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
@@ -26,7 +27,12 @@ public class RedisCache {
*/
public <T> T getCacheObject(final String key) {
ValueOperations<String, Object> operations = redisTemplate.opsForValue();
return (T) operations.get(key);
try {
return (T) operations.get(key);
} catch (QueryTimeoutException e) {
throw new RuntimeException("系统错误,通讯异常");
}
}
/**