Skip to content

Commit 2f86886

Browse files
committed
Allow floats in cache expiration
1 parent 3538585 commit 2f86886

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bolt-cache/bolt/cache/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ def value(self):
4343

4444
return self._model_instance.value
4545

46-
def set(self, value, expiration: datetime | timedelta | int | None = None):
46+
def set(self, value, expiration: datetime | timedelta | int | float | None = None):
4747
defaults = {
4848
"value": value,
4949
}
5050

51-
if isinstance(expiration, int):
51+
if isinstance(expiration, int, float):
5252
defaults["expires_at"] = timezone.now() + timedelta(seconds=expiration)
5353
elif isinstance(expiration, timedelta):
5454
defaults["expires_at"] = timezone.now() + expiration

0 commit comments

Comments
 (0)