summaryrefslogtreecommitdiffstats
path: root/wp-includes/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/cache.php')
-rw-r--r--wp-includes/cache.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/wp-includes/cache.php b/wp-includes/cache.php
index 6880624..b4c5b89 100644
--- a/wp-includes/cache.php
+++ b/wp-includes/cache.php
@@ -8,6 +8,8 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
function wp_cache_close() {
global $wp_object_cache;
+ if ( ! isset($wp_object_cache) )
+ return;
return $wp_object_cache->save();
}
@@ -415,8 +417,14 @@ class WP_Object_Cache {
}
function WP_Object_Cache() {
+ return $this->__construct();
+ }
+
+ function __construct() {
global $blog_id;
+ register_shutdown_function(array(&$this, "__destruct"));
+
if (defined('DISABLE_CACHE'))
return;
@@ -451,5 +459,10 @@ class WP_Object_Cache {
$this->blog_id = $this->hash($blog_id);
}
+
+ function __destruct() {
+ $this->save();
+ return true;
+ }
}
?>