diff options
Diffstat (limited to 'it_cache.class')
| -rw-r--r-- | it_cache.class | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/it_cache.class b/it_cache.class index 081db65..cec55dd 100644 --- a/it_cache.class +++ b/it_cache.class @@ -23,6 +23,7 @@ class it_cache { static $_fetch_func; static $_store_func; + static $_local = []; static function _defaults($p) { @@ -45,10 +46,10 @@ static function get($key, $p = array()) { $p = it_cache::_defaults($p); - if (isset($GLOBALS['it_cache_local'][$key])) + if (isset(it_cache::$_local[$key])) { # Use local copy - $result = $GLOBALS['it_cache_local'][$key]; + $result = it_cache::$_local[$key]; $success = true; } else if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p))) @@ -85,14 +86,14 @@ static function put($key, $value, $p = array()) if ($memsuccess === false && $p['safety'] == 1) it::error(array_filter([ 'title' => ($p['distributed'] ? "memcache (" . ($memcache ? ($memcache->getResultMessage() . " on " . $memcache->getServerByKey($key)['host']) : "n/a") . ")" : self::$_store_func) . " in it_cache::put failed", - 'body' => "key='$key'", + 'body' => "key='$key', value size=" . strlen(json_encode($value)), 'id' => $p['distributed'] ? "it_cache_fail_" . $memcache->getServerByKey($key)['host'] : "it_cache_fail", 'timewindow' => "1200-1300", 'blockmailid' => $memcache ? "memcache_on_" . $memcache->getServerByKey($key)['host'] : null, 'blockmail' => $memcache? 12*3600 : null, ])); - $GLOBALS['it_cache_local'][$key] = $value; # Also store local copy + it_cache::$_local[$key] = $value; # Also store local copy return $value; } |