Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3648 -- Added support for cmemcached Python library. Thanks, f…

…loguy@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4827 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a5bb14ed2e3e1a26a4f7312582cf3e350bdd3985 1 parent 9c10a2f
Adrian Holovaty authored March 25, 2007
7  django/core/cache/backends/memcached.py
@@ -3,9 +3,12 @@
3 3
 from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
4 4
 
5 5
 try:
6  
-    import memcache
  6
+    import cmemcache as memcache
7 7
 except ImportError:
8  
-    raise InvalidCacheBackendError, "Memcached cache backend requires the 'memcache' library"
  8
+    try:
  9
+        import memcache
  10
+    except:
  11
+        raise InvalidCacheBackendError("Memcached cache backend requires either the 'memcache' or 'cmemcache' library")
9 12
 
10 13
 class CacheClass(BaseCache):
11 14
     def __init__(self, server, params):
17  docs/cache.txt
@@ -66,10 +66,19 @@ deleting arbitrary data in the cache. All data is stored directly in memory,
66 66
 so there's no overhead of database or filesystem usage.
67 67
 
68 68
 After installing Memcached itself, you'll need to install the Memcached Python
69  
-bindings. They're in a single Python module, memcache.py, available at
70  
-ftp://ftp.tummy.com/pub/python-memcached/ . If that URL is no longer valid,
71  
-just go to the Memcached Web site (http://www.danga.com/memcached/) and get the
72  
-Python bindings from the "Client APIs" section.
  69
+bindings. Two versions of this are available. Choose and install *one* of the
  70
+following modules:
  71
+
  72
+    * The fastest available option is a module called ``cmemcache``, available
  73
+      at http://gijsbert.org/cmemcache/ . (This module is only compatible with
  74
+      the Django development version. Django 0.96 is only compatible with the
  75
+      second option, below.)
  76
+
  77
+    * If you can't install ``cmemcache``, you can install ``python-memcached``,
  78
+      available at ftp://ftp.tummy.com/pub/python-memcached/ . If that URL is
  79
+      no longer valid, just go to the Memcached Web site
  80
+      (http://www.danga.com/memcached/) and get the Python bindings from the
  81
+      "Client APIs" section.
73 82
 
74 83
 To use Memcached with Django, set ``CACHE_BACKEND`` to
75 84
 ``memcached://ip:port/``, where ``ip`` is the IP address of the Memcached

0 notes on commit a5bb14e

Please sign in to comment.
Something went wrong with that request. Please try again.