File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change 16
16
17
17
from django .conf import settings
18
18
from django .core .cache .backends .base import InvalidCacheBackendError
19
- from django .core .cache .backends .memcached import BaseMemcachedCache
19
+ from django .core .cache .backends .memcached import BaseMemcachedCache , DEFAULT_TIMEOUT
20
20
21
21
try :
22
22
import pylibmc
23
23
from pylibmc import Error as MemcachedError
24
24
except ImportError :
25
25
raise InvalidCacheBackendError ('Could not import pylibmc.' )
26
26
27
- try :
28
- from django .core .cache .backends .memcached import DEFAULT_TIMEOUT
29
- except ImportError :
30
- DEFAULT_TIMEOUT = None
31
-
32
27
33
28
log = logging .getLogger ('django.pylibmc' )
34
29
45
40
if not pylibmc .support_compression :
46
41
warnings .warn ('A compression level was provided but pylibmc was '
47
42
'not compiled with support for it.' )
48
- if not pylibmc .__version__ >= '1.3.0' :
49
- warnings .warn ('A compression level was provided but pylibmc 1.3.0 '
50
- 'or above is required to handle this option.' )
51
-
52
43
53
44
# Keyword arguments to configure compression options
54
- # based on capabilities of a provided pylibmc library.
55
45
COMPRESS_KWARGS = {
56
- # Requires pylibmc 1.0 and above. Given that the minumum supported
57
- # version (as of now) is 1.1, the parameter is always included.
58
46
'min_compress_len' : MIN_COMPRESS_LEN ,
47
+ 'compress_level' : COMPRESS_LEVEL ,
59
48
}
60
- if pylibmc .__version__ >= '1.3.0' :
61
- COMPRESS_KWARGS ['compress_level' ] = COMPRESS_LEVEL
62
49
63
50
64
51
class PyLibMCCache (BaseMemcachedCache ):
You can’t perform that action at this time.
0 commit comments