summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-04-15 15:38:35 +0000
committerDries Buytaert <dries@buytaert.net>2007-04-15 15:38:35 +0000
commit840bb124eaf249a4f66e6e5491e3ac0e8ad7a36f (patch)
treec930a50b9582f47ffd35cfe2f8cb5567ddea6f27 /includes
parentf4cbd7c63d0b3cc221b079ecff99a4693de3dabd (diff)
downloadbrdo-840bb124eaf249a4f66e6e5491e3ac0e8ad7a36f.tar.gz
brdo-840bb124eaf249a4f66e6e5491e3ac0e8ad7a36f.tar.bz2
- Patch #126867 by dmitrig01: made caching work with prefixing.
Diffstat (limited to 'includes')
-rw-r--r--includes/cache.inc18
1 files changed, 9 insertions, 9 deletions
diff --git a/includes/cache.inc b/includes/cache.inc
index 2f656541d..e7774a10b 100644
--- a/includes/cache.inc
+++ b/includes/cache.inc
@@ -17,11 +17,11 @@ function cache_get($key, $table = 'cache') {
$cache_flush = variable_get('cache_flush', 0);
if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) {
// Time to flush old cache data
- db_query("DELETE FROM {%s} WHERE expire != %d AND expire <= %d", $table, CACHE_PERMANENT, $cache_flush);
+ db_query("DELETE FROM {$table} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush);
variable_set('cache_flush', 0);
}
- $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {%s} WHERE cid = '%s'", $table, $key));
+ $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {$table} WHERE cid = '%s'", $key));
if (isset($cache->data)) {
// If the data is permanent or we're not enforcing a minimum cache lifetime
// always return the cached data.
@@ -92,9 +92,9 @@ function cache_get($key, $table = 'cache') {
*/
function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) {
db_lock_table($table);
- db_query("UPDATE {%s} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $table, $data, time(), $expire, $headers, $cid);
+ db_query("UPDATE {$table} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid);
if (!db_affected_rows()) {
- @db_query("INSERT INTO {%s} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $table, $cid, $data, time(), $expire, $headers);
+ @db_query("INSERT INTO {$table} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $cid, $data, time(), $expire, $headers);
}
db_unlock_tables();
}
@@ -141,26 +141,26 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) {
// Clear the cache for everyone, cache_flush_delay seconds have
// passed since the first request to clear the cache.
- db_query("DELETE FROM {%s} WHERE expire != %d AND expire < %d", $table, CACHE_PERMANENT, time());
+ db_query("DELETE FROM {$table} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time());
variable_set('cache_flush', 0);
}
}
else {
// No minimum cache lifetime, flush all temporary cache entries now.
- db_query("DELETE FROM {%s} WHERE expire != %d AND expire < %d", $table, CACHE_PERMANENT, time());
+ db_query("DELETE FROM {$table} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time());
}
}
else {
if ($wildcard) {
if ($cid == '*') {
- db_query("DELETE FROM {%s}", $table);
+ db_query("DELETE FROM {$table}");
}
else {
- db_query("DELETE FROM {%s} WHERE cid LIKE '%s%%'", $table, $cid);
+ db_query("DELETE FROM {$table} WHERE cid LIKE '%s%%'", $cid);
}
}
else {
- db_query("DELETE FROM {%s} WHERE cid = '%s'", $table, $cid);
+ db_query("DELETE FROM {$table} WHERE cid = '%s'", $cid);
}
}
}