Skip to content

Commit c148304

Browse files
committed
DATAREDIS-1195 - Polishing.
Simplify Expiration.from(…) construction. Original pull request: #553.
1 parent 2db93e9 commit c148304

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/springframework/data/redis/cache/DefaultRedisCacheWriter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,9 @@ public byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Durat
156156
try {
157157

158158
boolean put;
159+
159160
if (shouldExpireWithin(ttl)) {
160-
put = connection.set(key, value, Expiration.milliseconds(ttl.toMillis()), SetOption.ifAbsent());
161+
put = connection.set(key, value, Expiration.from(ttl), SetOption.ifAbsent());
161162
} else {
162163
put = connection.setNX(key, value);
163164
}

0 commit comments

Comments
 (0)