Changeset 8075
- Timestamp:
- 07/25/08 13:51:32 (1 year ago)
- Files:
-
- django/trunk/AUTHORS (modified) (2 diffs)
- django/trunk/django/core/cache/__init__.py (modified) (3 diffs)
- django/trunk/docs/cache.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r8033 r8075 237 237 Paul Lanier <planier@google.com> 238 238 Nicola Larosa <nico@teknico.net> 239 Lau Bech Lauritzen 239 240 Rune Rønde Laursen <runerl@skjoldhoej.dk> 240 241 Eugene Lazutkin <http://lazutkin.com/blog/> … … 342 343 Leo Shklovskii 343 344 jason.sidabras@gmail.com 345 Brenton Simpson <http://theillustratedlife.com> 344 346 Jozko Skrablin <jozko.skrablin@gmail.com> 345 347 Ben Slavin <benjamin.slavin@gmail.com> django/trunk/django/core/cache/__init__.py
r6822 r8075 20 20 from django.core.cache.backends.base import InvalidCacheBackendError 21 21 22 # Name for use in settings file --> name of module in "backends" directory. 23 # Any backend scheme that is not in this dictionary is treated as a Python 24 # import path to a custom backend. 22 25 BACKENDS = { 23 # name for use in settings file --> name of module in "backends" directory24 26 'memcached': 'memcached', 25 27 'locmem': 'locmem', … … 45 47 (scheme, DEPRECATED_BACKENDS[scheme]), DeprecationWarning) 46 48 scheme = DEPRECATED_BACKENDS[scheme] 47 if scheme not in BACKENDS:48 raise InvalidCacheBackendError, "%r is not a valid cache backend" % scheme49 49 50 50 host = rest[2:] … … 58 58 host = host[:-1] 59 59 60 cache_class = getattr(__import__('django.core.cache.backends.%s' % BACKENDS[scheme], {}, {}, ['']), 'CacheClass') 61 return cache_class(host, params) 60 if scheme in BACKENDS: 61 module = __import__('django.core.cache.backends.%s' % BACKENDS[scheme], {}, {}, ['']) 62 else: 63 module = __import__(scheme, {}, {}, ['']) 64 return getattr(module, 'CacheClass')(host, params) 62 65 63 66 cache = get_cache(settings.CACHE_BACKEND) django/trunk/docs/cache.txt
r7754 r8075 7 7 from database queries to template rendering to business logic -- to create the 8 8 page that your site's visitor sees. This is a lot more expensive, from a 9 processing-overhead perspective, than your standard read-a-file-off-the-filesystem10 server arrangement.9 processing-overhead perspective, than your standard 10 read-a-file-off-the-filesystem server arrangement. 11 11 12 12 For most Web applications, this overhead isn't a big deal. Most Web … … 186 186 187 187 CACHE_BACKEND = 'dummy:///' 188 189 Using a custom cache backend 190 ---------------------------- 191 192 **New in Django development version** 193 194 While Django includes support for a number of cache backends out-of-the-box, 195 sometimes you will want to use a customised verison or your own backend. To 196 use an external cache backend with Django, use a Python import path as the 197 scheme portion (the part before the initial colon) of the ``CACHE_BACKEND`` 198 URI, like so:: 199 200 CACHE_BACKEND = 'path.to.backend://' 201 202 If you're building your own backend, you can use the standard cache backends 203 as reference implementations. You'll find the code in the 204 ``django/core/cache/backends/`` directory of the Django source. 205 206 Note: Without a really compelling reason, like a host that doesn't support the 207 them, you should stick to the cache backends included with Django. They've 208 been really well-tested and are quite easy to use. 188 209 189 210 CACHE_BACKEND arguments
