Skip to content

Commit dd91873

Browse files
authored
Merge pull request #820 from kotyara1005/feature/DEFAULT_TIMEOUT
use DEFAULT_TIMEOUT
2 parents b24965d + db5fe1b commit dd91873

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

django_uwsgi/cache.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
from django.utils.encoding import force_bytes as stringify
33
except ImportError:
44
from django.utils.encoding import smart_str as stringify
5+
6+
try:
7+
from django.core.cache.backends.base import DEFAULT_TIMEOUT
8+
except IndexError:
9+
DEFAULT_TIMEOUT = object()
10+
511
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
612
from django.conf import settings
713

@@ -46,7 +52,7 @@ def get(self, key, default=None, version=None):
4652
return pickle.loads(val)
4753

4854
def _set(self, full_key, value, timeout):
49-
if timeout is True:
55+
if timeout is True or timeout is DEFAULT_TIMEOUT:
5056
uwsgi_timeout = self.default_timeout
5157
elif timeout is None or timeout is False:
5258
# Django 1.6+: Explicitly passing in timeout=None will set a non-expiring timeout.

0 commit comments

Comments
 (0)