一、Redis list的增删改查命令
参考 https://blog.csdn.net/thinkpet/article/details/91344637
二、SpringBoot中代码实现
示例代码如下
import org.springframework.data.redis.core.StringRedisTemplate;
public class Test {
@Autowired
StringRedisTemplate stringRedisTemplate;
//增加
stringRedisTemplate.opsForList().leftPush(RedisKeyConfig.REDIS_GRAYRELEAS_IOS_CONFIG_KEY
, JSON.toJSONString(form.getConfig()));
//查询
stringRedisTemplate.opsForList().range(RedisKeyConfig.REDIS_GRAYRELEAS_IOS_CONFIG_KEY, 0, -1);
//删除
stringRedisTemplate.opsForList().remove(RedisKeyConfig.REDIS_GRAYRELEAS_IOS_CONFIG_KEY, 0,JSON.toJSONString(delGrayConfig));
//修改,i为item下标
stringRedisTemplate.opsForList().set(RedisKeyConfig.REDIS_GRAYRELEAS_IOS_CONFIG_KEY, i, JSON.toJSONString(form.getConfig()));
}