From 2f3dc4f3d9d543fde65f968e60183dc24182e455 Mon Sep 17 00:00:00 2001 From: Karel Cemus Date: Fri, 11 Feb 2022 10:31:07 +0100 Subject: [PATCH] #247 SET command uses milliseconds PX instead of seconds EX --- CHANGELOG.md | 6 ++++++ .../play/api/cache/redis/connector/RedisConnectorImpl.scala | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10cc07a..05b41ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ ## Changelog +### [:link: 2.7.0](https://github.com/KarelCemus/play-redis/tree/2.7.0) + +SET command supports milliseconds, previous versions used seconds [#247](https://github.com/KarelCemus/play-redis/issues/247) + +Added support for sorted sets ZSET [#259](https://github.com/KarelCemus/play-redis/pull/259) + ### [:link: 2.6.1](https://github.com/KarelCemus/play-redis/tree/2.6.1) Support of `DEL` operation in redis cluster [#230](https://github.com/KarelCemus/play-redis/issues/230) diff --git a/src/main/scala/play/api/cache/redis/connector/RedisConnectorImpl.scala b/src/main/scala/play/api/cache/redis/connector/RedisConnectorImpl.scala index 3c9eb4e..8a30274 100644 --- a/src/main/scala/play/api/cache/redis/connector/RedisConnectorImpl.scala +++ b/src/main/scala/play/api/cache/redis/connector/RedisConnectorImpl.scala @@ -74,10 +74,10 @@ private[connector] class RedisConnectorImpl(serializer: AkkaSerializer, redis: R redis.set( key, value, - exSeconds = if (expiration.isFinite) Some(expiration.toSeconds) else None, + pxMilliseconds = if (expiration.isFinite) Some(expiration.toMillis) else None, NX = ifNotExists - ) executing "SET" withKey key andParameters s"$value${s" EX $expiration" when expiration.isFinite}${" NX" when ifNotExists}" logging { - case true if expiration.isFinite => log.debug(s"Set on key '$key' for ${expiration.toSeconds} seconds.") + ) executing "SET" withKey key andParameters s"$value${s" PX $expiration" when expiration.isFinite}${" NX" when ifNotExists}" logging { + case true if expiration.isFinite => log.debug(s"Set on key '$key' for ${expiration.toMillis} milliseconds.") case true => log.debug(s"Set on key '$key' for infinite seconds.") case false => log.debug(s"Set on key '$key' ignored. Condition was not met.") }