Changeset 4080 for site/plugins/includes/cache.inc
- Timestamp:
- 12/08/07 20:00:19 (2 years ago)
- Files:
-
- 1 modified
-
site/plugins/includes/cache.inc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
site/plugins/includes/cache.inc
r2219 r4080 1 1 <?php 2 // $Id: cache.inc,v 1.5 2006/11/10 07:26:27drumm Exp $2 // $Id: cache.inc,v 1.5.2.4 2007/06/27 03:35:48 drumm Exp $ 3 3 4 4 /** … … 18 18 if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) { 19 19 // Time to flush old cache data 20 db_query("DELETE FROM { %s} WHERE expire != %d AND expire <= %d", $table, CACHE_PERMANENT, $cache_flush);20 db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); 21 21 variable_set('cache_flush', 0); 22 22 } 23 23 24 $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM { %s} WHERE cid = '%s'", $table, $key));24 $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {". $table ."} WHERE cid = '%s'", $key)); 25 25 if (isset($cache->data)) { 26 26 // If the data is permanent or we're not enforcing a minimum cache lifetime … … 93 93 function cache_set($cid, $table = 'cache', $data, $expire = CACHE_PERMANENT, $headers = NULL) { 94 94 db_lock_table($table); 95 db_query("UPDATE { %s} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $table, $data, time(), $expire, $headers, $cid);95 db_query("UPDATE {". $table. "} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid); 96 96 if (!db_affected_rows()) { 97 @db_query("INSERT INTO { %s} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $table, $cid, $data, time(), $expire, $headers);97 @db_query("INSERT INTO {". $table. "} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $cid, $data, time(), $expire, $headers); 98 98 } 99 99 db_unlock_tables(); … … 142 142 // Clear the cache for everyone, cache_flush_delay seconds have 143 143 // passed since the first request to clear the cache. 144 db_query("DELETE FROM { %s} WHERE expire != %d AND expire < %d", $table, CACHE_PERMANENT, time());144 db_query("DELETE FROM {". $table. "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); 145 145 variable_set('cache_flush', 0); 146 146 } … … 148 148 else { 149 149 // No minimum cache lifetime, flush all temporary cache entries now. 150 db_query("DELETE FROM { %s} WHERE expire != %d AND expire < %d", $table, CACHE_PERMANENT, time());150 db_query("DELETE FROM {". $table. "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); 151 151 } 152 152 } … … 154 154 if ($wildcard) { 155 155 if ($cid == '*') { 156 db_query(" TRUNCATE TABLE {%s}", $table);156 db_query("DELETE FROM {". $table. "}"); 157 157 } 158 158 else { 159 db_query("DELETE FROM { %s} WHERE cid LIKE '%s%%'", $table, $cid);159 db_query("DELETE FROM {". $table. "} WHERE cid LIKE '%s%%'", $cid); 160 160 } 161 161 } 162 162 else { 163 db_query("DELETE FROM { %s} WHERE cid = '%s'", $table, $cid);163 db_query("DELETE FROM {". $table. "} WHERE cid = '%s'", $cid); 164 164 } 165 165 }
