互联网安全架构-纯手互联网API接口幂等框架
作者:互联网
网站安全漏洞扫描
互联网API接口幂等设计
BaseRedisService封装Redis
@Component
public class BaseRedisService {
@Autowired
private StringRedisTemplate stringRedisTemplate;
public void setString(String key, Object data, Long timeout) {
if (data instanceof String) {
String value = (String) data;
stringRedisTemplate.opsForValue().set(key, value);
}
if (timeout != null) {
stringRedisTemplate.expire(key, timeout, TimeUnit.SECONDS);
}
}
public Object getString(String key) {
return stringRedisTemplate.opsForValue().get(key);
}
public void delKey(String key) {
stringRedisTemplate.delete(key);
}
}
RedisTokenUtils工具类
@Component
public class RedisTokenUtils {
private long timeout = 60 * 60;
@Autowired
private BaseR
标签:纯手,String,互联网安全,timeout,private,public,API,key,stringRedisTemplate 来源: https://blog.csdn.net/qq_31784189/article/details/122546347