springboot集成redis
1.导入spring-boot-starter-data-redis起步依赖

2.在配置文件中, 配置redis连接信息

3.调用API(StringRedisTemplate)完成字符串的存取操作
//把token存储在redis中
ValueOperations<String, String> operations = stringRedisTemplate.opsForValue();
operations.set(token,token,1, TimeUnit.HOURS);
//删除存储在redis中的token
ValueOperations<String, String> operations = stringRedisTemplate.opsForValue();
operations.getOperations().delete(token);

浙公网安备 33010602011771号