Django

Code

Changeset 6589

Show
Ignore:
Timestamp:
10/21/07 14:19:32 (9 months ago)
Author:
mtredinnick
Message:

Fixed a bug in the db cache backend introduced in [6572].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/cache/backends/db.py

    r6572 r6589  
    2525            self._cull_frequency = 3 
    2626 
    27     def add(self, key, value, timeout=None): 
    28         return self._base_set('add', key, value, timeout) 
    29  
    3027    def get(self, key, default=None): 
    3128        cursor = connection.cursor() 
     
    4340    def set(self, key, value, timeout=None): 
    4441        return self._base_set('set', key, value, timeout) 
     42 
     43    def add(self, key, value, timeout=None): 
     44        return self._base_set('add', key, value, timeout) 
    4545 
    4646    def _base_set(self, mode, key, value, timeout=None): 
     
    6060                cursor.execute("UPDATE %s SET value = %%s, expires = %%s WHERE cache_key = %%s" % self._table, [encoded, str(exp), key]) 
    6161            else: 
    62                 if mode == 'add': 
    63                     cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)]) 
     62                cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)]) 
    6463        except DatabaseError: 
    6564            # To be threadsafe, updates/inserts are allowed to fail silently