Skip to content

Commit cde77bf

Browse files
dnltskderXear
authored andcommitted
fix TTL unit (EpochMillis -> EpochSeconds)
1 parent 2ad6367 commit cde77bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/dasburo/spring/cache/dynamo/DefaultDynamoCacheWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private void putInternal(String name, String key, @Nullable byte[] value, @Nulla
216216
}
217217

218218
if (shouldExpireWithin(ttl)) {
219-
attributeValues.put(ATTRIBUTE_TTL, new AttributeValue().withN(String.valueOf(Instant.now().toEpochMilli() + ttl.toMillis())));
219+
attributeValues.put(ATTRIBUTE_TTL, new AttributeValue().withN(String.valueOf(Instant.now().plus(ttl).getEpochSecond())));
220220
}
221221

222222
PutItemRequest putItemRequest = new PutItemRequest()

0 commit comments

Comments
 (0)