          return pickle.loads(base64.decodestring(row[1]))
  
      def set(self, key, value, timeout=None):
          if timeout is None:
              timeout = self.default_timeout
          cursor = connection.cursor()
          cursor.execute("SELECT COUNT(*) FROM %s" % self._table)
          num = cursor.fetchone()[0]
 
</s> remove             if cursor.fetchone():
 </s> add             if mode == 'set' and cursor.fetchone():
        return self._base_set('set', key, value, timeout)

    def _base_set(self, mode, key, value, timeout=None):
          return pickle.loads(base64.decodestring(row[1]))
  
      def set(self, key, value, timeout=None):
        return self._base_set('set', key, value, timeout)

    def _base_set(self, mode, key, value, timeout=None):
          if timeout is None:
              timeout = self.default_timeout
          cursor = connection.cursor()
          cursor.execute("SELECT COUNT(*) FROM %s" % self._table)
          num = cursor.fetchone()[0]
keep keep add keep keep keep keep keep
 Fixed #4831 -- Added an "add" cache key method, for parity with memcached's
API. This works for all cache backends. Patch from Matt McClanahan.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6572 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/core/cache/backends/db.py