ERR invalid expire time in setex

  • Post author:
  • Post category:其他


       org.springframework.dao.InvalidDataAccessApiUsageException:
        ERR invalid expire time in setex; nested exception is redis.clients.jedis.exceptions.JedisDataException:
        ERR invalid expire time in setex  at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:69)
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:42)
        at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44)
        at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42)
        at org.springframework.data.redis.connection.jedis.JedisClusterConnection.convertJedisAccessException(JedisClusterConnection.java:777)
        at org.springframework.data.redis.connection.jedis.JedisClusterStringCommands.convertJedisAccessException(JedisClusterStringCommands.java:525)
        at org.springframework.data.redis.connection.jedis.JedisClusterStringCommands.setEx(JedisClusterStringCommands.java:177)
        at org.springframework.data.redis.connection.DefaultedRedisConnection.setEx(DefaultedRedisConnection.java:308)
        at org.springframework.data.redis.core.DefaultValueOperations$4.potentiallyUsePsetEx(DefaultValueOperations.java:268)
        at org.springframework.data.redis.core.DefaultValueOperations$4.doInRedis(DefaultValueOperations.java:261)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188)
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96)
        at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:256)
        at com.cmic.origin.safe.service.impl.RedisServiceImpl.set(RedisServiceImpl.java:27)
        at com.cmic.origin.safe.schedule.SendMsgSchedule.sendSmsAndUpdateRecord(SendMsgSchedule.java:346)
        at com.cmic.origin.safe.schedule.SendMsgSchedule.sendMessage(SendMsgSchedule.java:298)
        at com.cmic.origin.safe.schedule.SendMsgSchedule.execute(SendMsgSchedule.java:132)
        at com.dangdang.ddframe.job.executor.type.SimpleJobExecutor.process(SimpleJobExecutor.java:41)
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:206)
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.process(AbstractElasticJobExecutor.java:171)
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:150)
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:122)
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
        Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR invalid expire

异常背景

通过有效期的截止时间减去当前时间获取缓存生效时间

long seconds = bo.getEndTime().getTime()- System.currentTimeMillis();

在存储生效时间时,对时间Long进行强制转换时 (int)seconds发生异常

在这里插入图片描述

在这里插入图片描述



版权声明:本文为weixin_42691149原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。