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
5a9b2bce
Kaydet (Commit)
5a9b2bce
authored
Şub 24, 2013
tarafından
Bas Peschier
Kaydeden (comit)
Aymeric Augustin
Şub 24, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19810 -- MemcachedCache now uses pickle.HIGHEST_PROTOCOL
üst
d7e835f7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
memcached.py
django/core/cache/backends/memcached.py
+7
-0
1.6.txt
docs/releases/1.6.txt
+3
-0
tests.py
tests/regressiontests/cache/tests.py
+13
-0
No files found.
django/core/cache/backends/memcached.py
Dosyayı görüntüle @
5a9b2bce
"Memcached cache backend"
import
time
import
pickle
from
threading
import
local
from
django.core.cache.backends.base
import
BaseCache
,
InvalidCacheBackendError
...
...
@@ -146,6 +147,12 @@ class MemcachedCache(BaseMemcachedCache):
library
=
memcache
,
value_not_found_exception
=
ValueError
)
@property
def
_cache
(
self
):
if
getattr
(
self
,
'_client'
,
None
)
is
None
:
self
.
_client
=
self
.
_lib
.
Client
(
self
.
_servers
,
pickleProtocol
=
pickle
.
HIGHEST_PROTOCOL
)
return
self
.
_client
class
PyLibMCCache
(
BaseMemcachedCache
):
"An implementation of a cache binding using pylibmc"
def
__init__
(
self
,
server
,
params
):
...
...
docs/releases/1.6.txt
Dosyayı görüntüle @
5a9b2bce
...
...
@@ -89,6 +89,9 @@ Minor features
:class:`~django.http.HttpResponsePermanentRedirect` now provide an ``url``
attribute (equivalent to the URL the response will redirect to).
* The ``MemcachedCache`` cache backend now uses the latest :mod:`pickle`
protocol available.
* Added the :attr:`django.db.models.ForeignKey.db_constraint`
option.
...
...
tests/regressiontests/cache/tests.py
Dosyayı görüntüle @
5a9b2bce
...
...
@@ -12,6 +12,7 @@ import string
import
tempfile
import
time
import
warnings
import
pickle
from
django.conf
import
settings
from
django.core
import
management
...
...
@@ -984,6 +985,18 @@ class MemcachedCacheTests(unittest.TestCase, BaseCacheTests):
# memcached limits key length to 250
self
.
assertRaises
(
Exception
,
self
.
cache
.
set
,
'a'
*
251
,
'value'
)
# Explicitly display a skipped test if no configured cache uses MemcachedCache
@unittest.skipUnless
(
any
(
cache
[
'BACKEND'
]
==
'django.core.cache.backends.memcached.MemcachedCache'
for
cache
in
settings
.
CACHES
.
values
()),
"cache with python-memcached library not available"
)
def
test_memcached_uses_highest_pickle_version
(
self
):
# Regression test for #19810
for
cache_key
,
cache
in
settings
.
CACHES
.
items
():
if
cache
[
'BACKEND'
]
==
'django.core.cache.backends.memcached.MemcachedCache'
:
self
.
assertEqual
(
get_cache
(
cache_key
)
.
_cache
.
pickleProtocol
,
pickle
.
HIGHEST_PROTOCOL
)
class
FileBasedCacheTests
(
unittest
.
TestCase
,
BaseCacheTests
):
"""
...
...
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