From 48e812752db3f260dd684254e574a89dcf5a1ebb Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 26 Mar 2009 16:54:44 +0000 Subject: Store and use local copy to make put ... get reliable within one request --- it_cache.class | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/it_cache.class b/it_cache.class index c3677e3..d6d3029 100644 --- a/it_cache.class +++ b/it_cache.class @@ -47,7 +47,9 @@ function get($key, $p = array()) { $p = it_cache::_defaults($p); - if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p))) + if ($result = $GLOBALS['it_cache_local'][$key]) + ; # Use local copy + else if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p))) $result = @$memcache->get($key); else $result = function_exists("eaccelerator_get") ? eaccelerator_get($key) : null; @@ -76,6 +78,8 @@ function put($key, $value, $p = array()) $result = function_exists("eaccelerator_put") ? eaccelerator_put($key, $value, $p['ttl']) : null; } + $GLOBALS['it_cache_local'][$key] = $value; # Also store local copy + return $result; } -- cgit v1.2.3