ecshop缓存函数
/**
* 读结果缓存文件
*
* @params string $cache_name
*
* @return array $data
*/
function read_static_cache($cache_name)
{
if ((DEBUG_MODE & 2) == 2)
{
return false;
}
static $result = array();
if (!empty($result[$cache_name]))
{
return $result[$cache_name];
}
$cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php';
if (file_exists($cache_file_path))
{
include_once($cache_file_path);
$result[$cache_name] = $data;
return $result[$cache_name];
}
else
{
return false;
}
}
/**
* 写结果缓存文件
*
* @params string $cache_name
* @params string $caches
*
* @return
*/
function write_static_cache($cache_name, $caches)
{
if ((DEBUG_MODE & 2) == 2)
{
return false;
}
$cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php';
$content = " $content .= "\$data = " . var_export($caches, true) . ";\r\n";
$content .= "?>";
file_put_contents($cache_file_path, $content, LOCK_EX);
}
/**
* 读结果缓存文件
*
* @params string $cache_name
*
* @return array $data
*/
function read_static_cache($cache_name)
{
if ((DEBUG_MODE & 2) == 2)
{
return false;
}
static $result = array();
if (!empty($result[$cache_name]))
{
return $result[$cache_name];
}
$cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php';
if (file_exists($cache_file_path))
{
include_once($cache_file_path);
$result[$cache_name] = $data;
return $result[$cache_name];
}
else
{
return false;
}
}
/**
* 写结果缓存文件
*
* @params string $cache_name
* @params string $caches
*
* @return
*/
function write_static_cache($cache_name, $caches)
{
if ((DEBUG_MODE & 2) == 2)
{
return false;
}
$cache_file_path = ROOT_PATH . '/temp/static_caches/' . $cache_name . '.php';
$content = " $content .= "\$data = " . var_export($caches, true) . ";\r\n";
$content .= "?>";
file_put_contents($cache_file_path, $content, LOCK_EX);
}
作者:noel@SEO
地址:http://www.laohucheng.com/post/418/
版权所有©转载时必须以链接形式注明作者和原始出处及本声明!
把ECSHOP的升级提醒删除
ecshop关于邮件模板翻译的函数
2009
11:41
288
0


