1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Edited docs and docstring changes from [6572] (new cache add() method)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6774 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2007-11-30 05:30:43 +00:00
parent 7ea174ef14
commit 9e762f4407
2 changed files with 9 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ class BaseCache(object):
def add(self, key, value, timeout=None):
"""
Set a value in the cache if the key does not already exist. If
Set a value in the cache if the key does not already exist. If
timeout is given, that timeout will be used for the key; otherwise
the default cache timeout will be used.
"""
@@ -24,14 +24,14 @@ class BaseCache(object):
def get(self, key, default=None):
"""
Fetch a given key from the cache. If the key does not exist, return
Fetch a given key from the cache. If the key does not exist, return
default, which itself defaults to None.
"""
raise NotImplementedError
def set(self, key, value, timeout=None):
"""
Set a value in the cache. If timeout is given, that timeout will be
Set a value in the cache. If timeout is given, that timeout will be
used for the key; otherwise the default cache timeout will be used.
"""
raise NotImplementedError
@@ -44,10 +44,10 @@ class BaseCache(object):
def get_many(self, keys):
"""
Fetch a bunch of keys from the cache. For certain backends (memcached,
Fetch a bunch of keys from the cache. For certain backends (memcached,
pgsql) this can be *much* faster when fetching multiple values.
Returns a dict mapping each key in keys to its value. If the given
Returns a dict mapping each key in keys to its value. If the given
key is missing, it will be missing from the response dict.
"""
d = {}
@@ -64,4 +64,3 @@ class BaseCache(object):
return self.get(key) is not None
__contains__ = has_key