              cursor.execute("DELETE FROM %s WHERE expires < %%s" % self._table, [str(now)])
              cursor.execute("SELECT COUNT(*) FROM %s" % self._table)
              num = cursor.fetchone()[0]
              if num > self._max_entries:
                  cursor.execute("SELECT key FROM %s ORDER BY key LIMIT 1 OFFSET %%s" % self._table, [num / self._cull_frequency])
                  cursor.execute("DELETE FROM %s WHERE key < %%s" % self._table, [cursor.fetchone()[0]])
          
  ##########################################
  # Read settings and load a cache backend #
  ##########################################
  
 
</s> remove         cursor.execute("SELECT key FROM %s WHERE key = %%s" % self._table, [key])
 </s> add         cursor.execute("SELECT cache_key FROM %s WHERE cache_key = %%s" % self._table, [key]) </s> remove         cursor.execute("SELECT key FROM %s WHERE key = %%s" % self._table, [key])
 </s> add         cursor.execute("SELECT cache_key FROM %s WHERE cache_key = %%s" % self._table, [key]) </s> remove         cursor.execute("DELETE FROM %s WHERE key = %%s" % self._table, [key])
 </s> add         cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % self._table, [key]) </s> remove             cursor.execute("DELETE FROM %s WHERE key = %%s" % self._table, [key])
 </s> add             cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % self._table, [key]) </s> remove         cursor.execute("SELECT key, value, expires FROM %s WHERE key = %%s" % self._table, [key])
 </s> add         cursor.execute("SELECT cache_key, value, expires FROM %s WHERE cache_key = %%s" % self._table, [key])
                cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % self._table, [num / self._cull_frequency])
                cursor.execute("DELETE FROM %s WHERE cache_key < %%s" % self._table, [cursor.fetchone()[0]])
              cursor.execute("DELETE FROM %s WHERE expires < %%s" % self._table, [str(now)])
              cursor.execute("SELECT COUNT(*) FROM %s" % self._table)
              num = cursor.fetchone()[0]
              if num > self._max_entries:
                cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % self._table, [num / self._cull_frequency])
                cursor.execute("DELETE FROM %s WHERE cache_key < %%s" % self._table, [cursor.fetchone()[0]])
                cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % self._table, [num / self._cull_frequency])
                cursor.execute("DELETE FROM %s WHERE cache_key < %%s" % self._table, [cursor.fetchone()[0]])
          
  ##########################################
  # Read settings and load a cache backend #
  ##########################################
  
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #515 (again) - renamed "key" field in SQL cache to "cache_key" because 
MySQL reserves "key".


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