我正在将字符串放入 redis 服务器:
stringRedis.opsForValue().set(redisKey, email, ACTIVATION_CODE_TIMEOUT);
但是我终于在redis中得到了'\x00\x00\x00\x00 ... my-value':
为什么会这样?
最佳答案
抱歉这个问题。我的错。我在使用 set()
方法时犯了错误。 set() 方法的第三个参数不是超时值。这是抵消。要修复它:
stringRedis.opsForValue().set(redisKey, email, ACTIVATION_CODE_TIMEOUT, TimeUnit.SECONDS);
关于spring-data-redis - 使用 StringRedisTemplate 时有很多 '\x00' 前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42824593/