From eeae9d5c09399fa7cb89fe52d5676bf18fa61457 Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 29 Jan 2007 17:58:05 +0000 Subject: Caching fixes, see http://mu.wordpress.org/forums/topic.php?id=3143&replies=23 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@872 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/cache.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'wp-includes/cache.php') diff --git a/wp-includes/cache.php b/wp-includes/cache.php index b4c5b89..6b02ba3 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -84,9 +84,12 @@ class WP_Object_Cache { if (false !== array_search($group, $this->global_groups)) $prefix = ''; else - $prefix = $blog_id . ':'; + $prefix = $blog_id . '-'; - return "$prefix$group:$key"; + if( '' != $key ) + $key = '-' . $key; + + return "$prefix$group$key"; } @@ -349,22 +352,21 @@ class WP_Object_Cache { // Loop over dirty objects and save them. $errors = 0; foreach ($this->dirty_objects as $group => $ids) { - $group_key = $this->key( '', $group ); - $group_dir = $this->make_group_dir($group_key, $dir_perms); + $group_dir = $this->make_group_dir($group, $dir_perms); $ids = array_unique($ids); foreach ($ids as $id) { - $cache_file = $group_dir.$this->hash($id).'.php'; + $cache_file = $group_dir.$this->hash($group.'-'.$id).'.php'; // Remove the cache file if the key is not set. - if (!isset ($this->cache[$group][$id])) { + if (!isset ($this->cache[$group.'-'.$id])) { if (file_exists($cache_file)) @ unlink($cache_file); continue; } $temp_file = tempnam($group_dir, 'tmp'); - $serial = CACHE_SERIAL_HEADER.base64_encode(serialize($this->cache[$group][$id])).CACHE_SERIAL_FOOTER; + $serial = CACHE_SERIAL_HEADER.base64_encode(serialize($this->cache[$group.'-'.$id])).CACHE_SERIAL_FOOTER; $fd = @fopen($temp_file, 'w'); if ( false === $fd ) { $errors++; -- cgit