在spring中 针对 RedisTemplate类:

  private RedisTemplate<String, String> template;

当调用下面方法

  template.opsForValue().set(key, value,times, timeUnit);

 当指定timeUnit为TimeUnit.MILLISECONDS 将抛出下面异常

redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'PSETEX'

 

原因:

  因为redis版本过低  我的redis版本为2点几的,不支持毫秒级别及以下的 过期时间类型

将redis版本升级到3 就没事了

相关文章:

  • 2021-09-17
  • 2021-07-09
  • 2021-06-30
  • 2021-09-08
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-12-07
  • 2022-12-23
相关资源
相似解决方案