summaryrefslogtreecommitdiff
path: root/it_cache.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_cache.class')
-rw-r--r--it_cache.class9
1 files changed, 7 insertions, 2 deletions
diff --git a/it_cache.class b/it_cache.class
index 095becc..724651f 100644
--- a/it_cache.class
+++ b/it_cache.class
@@ -23,6 +23,8 @@
class it_cache
{
+ static $_fetch_func;
+ static $_store_func;
static function _defaults($p)
{
@@ -53,7 +55,7 @@ static function get($key, $p = array())
else if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p)))
$result = @$memcache->get($key);
else
- $result = function_exists("apc_fetch") ? apc_fetch($key) : (function_exists("eaccelerator_get") ? eaccelerator_get($key) : null);
+ $result = ($func = self::$_fetch_func) ? $func($key) : null;
return $result;
}
@@ -77,7 +79,7 @@ static function put($key, $value, $p = array())
else
{
function_exists("eaccelerator_gc") && eaccelerator_gc();
- $result = function_exists("apc_store") ? apc_store($key, $value, $p['ttl']) : (function_exists("eaccelerator_put") ? eaccelerator_put($key, $value, $p['ttl']) : null);
+ $result = ($func = self::$_store_func) ? $func($key, $value, $p['ttl']) : null;
}
$GLOBALS['it_cache_local'][$key] = $value; # Also store local copy
@@ -104,4 +106,7 @@ static function _get_memcache($p)
}
+it_cache::$_fetch_func = function_exists("apcu_fetch") ? "apcu_fetch" : (function_exists("apc_fetch") ? "apc_fetch" : (function_exists("eaccelerator_get") ? "eaccelerator_get" : null));
+it_cache::$_store_func = function_exists("apcu_store") ? "apcu_store" : (function_exists("apc_store") ? "apc_store" : (function_exists("eaccelerator_put") ? "eaccelerator_put" : null));
+
?>