          except (ValueError, TypeError):
              self._cull_frequency = 3
  
      def get(self, key, default=None):
          cursor = connection.cursor()
          cursor.execute("SELECT cache_key, value, expires FROM %s WHERE cache_key = %%s" % self._table, [key])
          row = cursor.fetchone()
          if row is None:
 
</s> remove             if cursor.fetchone():
 </s> add             if mode == 'set' and cursor.fetchone(): </s> remove                 cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)])
 </s> add                 if mode == 'add':
                    cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)])
    def add(self, key, value, timeout=None):
        return self._base_set('add', key, value, timeout)

          except (ValueError, TypeError):
              self._cull_frequency = 3
  
    def add(self, key, value, timeout=None):
        return self._base_set('add', key, value, timeout)

      def get(self, key, default=None):
          cursor = connection.cursor()
          cursor.execute("SELECT cache_key, value, expires FROM %s WHERE cache_key = %%s" % self._table, [key])
          row = cursor.fetchone()
          if row is None:
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