|
@@ -1565,7 +1565,8 @@ function halt($error){
|
|
|
* @param string $content 待压缩的内容
|
|
|
* @return string
|
|
|
*/
|
|
|
- function compress_code($content) {
|
|
|
+function compress_code($content)
|
|
|
+{
|
|
|
$stripStr = '';
|
|
|
//分析php源码
|
|
|
$tokens = token_get_all($content);
|
|
@@ -1635,7 +1636,8 @@ function get_obj_instance($class, $method='', $args = array())
|
|
|
* @param int $type 1一维数组2二维数组
|
|
|
* @return array
|
|
|
*/
|
|
|
-function array_under_reset($array, $key, $type=1){
|
|
|
+function array_under_reset($array, $key, $type=1)
|
|
|
+{
|
|
|
if (is_array($array)){
|
|
|
$tmp = array();
|
|
|
foreach ($array as $v) {
|
|
@@ -1700,6 +1702,7 @@ function rkcache($key, $callback = false)
|
|
|
*/
|
|
|
function wkcache($key, $value, $expire = null)
|
|
|
{
|
|
|
+ $start = microtime(true);
|
|
|
if (C('cache_open')) {
|
|
|
$cacher = Cache::getInstance('cacheredis');
|
|
|
} else {
|
|
@@ -1709,7 +1712,9 @@ function wkcache($key, $value, $expire = null)
|
|
|
throw new Exception('Cannot fetch cache object!');
|
|
|
}
|
|
|
|
|
|
- return $cacher->set($key, $value, null, $expire);
|
|
|
+ $ret = $cacher->set($key, $value, null, $expire);
|
|
|
+ perfor_period("wkcache",$start,$key);
|
|
|
+ return $ret;
|
|
|
}
|
|
|
/**
|
|
|
* KV缓存 删
|
|
@@ -1719,6 +1724,7 @@ function wkcache($key, $value, $expire = null)
|
|
|
*/
|
|
|
function dkcache($key)
|
|
|
{
|
|
|
+ $start = microtime(true);
|
|
|
if (C('cache_open')) {
|
|
|
$cacher = Cache::getInstance('cacheredis');
|
|
|
} else {
|
|
@@ -1728,7 +1734,9 @@ function dkcache($key)
|
|
|
throw new Exception('Cannot fetch cache object!');
|
|
|
}
|
|
|
|
|
|
- return $cacher->rm($key);
|
|
|
+ $ret = $cacher->rm($key);
|
|
|
+ perfor_period("dkcache",$start,$key);
|
|
|
+ return $ret;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1792,12 +1800,16 @@ function wcache($key = null, $data = array(), $prefix, $period = 0)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ $start = microtime(true);
|
|
|
$period = intval($period);
|
|
|
if ($period != 0) {
|
|
|
$data['cache_expiration_time'] = time() + $period * 60;
|
|
|
}
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- return $ins->hset($key, $prefix, $data);
|
|
|
+ $ret = $ins->hset($key, $prefix, $data);
|
|
|
+ perfor_period("wcache",$start,$key);
|
|
|
+
|
|
|
+ return $ret;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1812,8 +1824,12 @@ function dcache($key = null, $prefix = '')
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ $start = microtime(true);
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- return $ins->hdel($key, $prefix);
|
|
|
+ $ret = $ins->hdel($key, $prefix);
|
|
|
+ perfor_period("dcache",$start,$key);
|
|
|
+
|
|
|
+ return $ret;
|
|
|
}
|
|
|
|
|
|
/**
|