Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
4529af9e
Kaydet (Commit)
4529af9e
authored
Haz 16, 2014
tarafından
Vincent-Vega
Kaydeden (comit)
Tim Graham
Haz 16, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22845 -- Correctly handled memcached default timeout value.
üst
b341f336
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
memcached.py
django/core/cache/backends/memcached.py
+1
-1
tests.py
tests/cache/tests.py
+18
-0
No files found.
django/core/cache/backends/memcached.py
Dosyayı görüntüle @
4529af9e
...
...
@@ -49,7 +49,7 @@ class BaseMemcachedCache(six.with_metaclass(BaseMemcachedCacheMethods, BaseCache
way. Call this function to obtain a safe value for your timeout.
"""
if
timeout
==
DEFAULT_TIMEOUT
:
return
self
.
default_timeout
timeout
=
self
.
default_timeout
if
timeout
is
None
:
# Using 0 in memcache sets a non-expiring timeout.
...
...
tests/cache/tests.py
Dosyayı görüntüle @
4529af9e
...
...
@@ -1078,6 +1078,12 @@ for _cache_params in settings.CACHES.values():
if
_cache_params
[
'BACKEND'
]
.
startswith
(
'django.core.cache.backends.memcached.'
):
memcached_params
=
_cache_params
memcached_never_expiring_params
=
memcached_params
.
copy
()
memcached_never_expiring_params
[
'TIMEOUT'
]
=
None
memcached_far_future_params
=
memcached_params
.
copy
()
memcached_far_future_params
[
'TIMEOUT'
]
=
31536000
# 60*60*24*365, 1 year
@unittest.skipUnless
(
memcached_params
,
"memcached not available"
)
@override_settings
(
CACHES
=
caches_setting_for_tests
(
base
=
memcached_params
))
...
...
@@ -1109,6 +1115,18 @@ class MemcachedCacheTests(BaseCacheTests, TestCase):
self
.
assertEqual
(
caches
[
cache_key
]
.
_cache
.
pickleProtocol
,
pickle
.
HIGHEST_PROTOCOL
)
@override_settings
(
CACHES
=
caches_setting_for_tests
(
base
=
memcached_never_expiring_params
))
def
test_default_never_expiring_timeout
(
self
):
# Regression test for #22845
cache
.
set
(
'infinite_foo'
,
'bar'
)
self
.
assertEqual
(
cache
.
get
(
'infinite_foo'
),
'bar'
)
@override_settings
(
CACHES
=
caches_setting_for_tests
(
base
=
memcached_far_future_params
))
def
test_default_far_future_timeout
(
self
):
# Regression test for #22845
cache
.
set
(
'future_foo'
,
'bar'
)
self
.
assertEqual
(
cache
.
get
(
'future_foo'
),
'bar'
)
def
test_cull
(
self
):
# culling isn't implemented, memcached deals with it.
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment