diff options
author | Christian Schneider | 2009-03-26 16:54:44 +0000 |
---|---|---|
committer | Christian Schneider | 2009-03-26 16:54:44 +0000 |
commit | 48e812752db3f260dd684254e574a89dcf5a1ebb (patch) | |
tree | 3724090ff111002ac8278aa37fe2e1208d9079a0 | |
parent | abacbf0fa99e8ee5d34d97505c6511715066cc27 (diff) | |
download | itools-48e812752db3f260dd684254e574a89dcf5a1ebb.tar.gz itools-48e812752db3f260dd684254e574a89dcf5a1ebb.tar.bz2 itools-48e812752db3f260dd684254e574a89dcf5a1ebb.zip |
Store and use local copy to make put ... get reliable within one request
-rw-r--r-- | it_cache.class | 6 |
1 files changed, 5 insertions, 1 deletions
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; } |