更新到正式版1.0
This commit is contained in:
80
core/class/cache/cache_sql.php
vendored
80
core/class/cache/cache_sql.php
vendored
@@ -1,41 +1,41 @@
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class ultrax_cache {
|
||||
|
||||
function ultrax_cache($conf) {
|
||||
$this->conf = $conf;
|
||||
}
|
||||
|
||||
function get_cache($key) {
|
||||
static $data = null;
|
||||
if(!isset($data[$key])) {
|
||||
$cache = C::t('cache')->fetch($key);
|
||||
if(!$cache) {
|
||||
return false;
|
||||
}
|
||||
$data[$key] = unserialize($cache['cachevalue']);
|
||||
if($cache['life'] && ($cache['dateline'] < time() - $data[$key]['life'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $data[$key]['data'];
|
||||
}
|
||||
|
||||
function set_cache($key, $value, $life) {
|
||||
$data = array(
|
||||
'cachekey' => $key,
|
||||
'cachevalue' => serialize(array('data' => $value, 'life' => $life)),
|
||||
'dateline' => time(),
|
||||
);
|
||||
return C::t('cache')->insert($data);
|
||||
}
|
||||
|
||||
function del_cache($key) {
|
||||
return C::t('cache')->delete($key);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
if(!defined('IN_OAOOA')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class ultrax_cache {
|
||||
|
||||
function ultrax_cache($conf) {
|
||||
$this->conf = $conf;
|
||||
}
|
||||
|
||||
function get_cache($key) {
|
||||
static $data = null;
|
||||
if(!isset($data[$key])) {
|
||||
$cache = C::t('cache')->fetch($key);
|
||||
if(!$cache) {
|
||||
return false;
|
||||
}
|
||||
$data[$key] = unserialize($cache['cachevalue']);
|
||||
if($cache['life'] && ($cache['dateline'] < time() - $data[$key]['life'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $data[$key]['data'];
|
||||
}
|
||||
|
||||
function set_cache($key, $value, $life) {
|
||||
$data = array(
|
||||
'cachekey' => $key,
|
||||
'cachevalue' => serialize(array('data' => $value, 'life' => $life)),
|
||||
'dateline' => time(),
|
||||
);
|
||||
return C::t('cache')->insert($data);
|
||||
}
|
||||
|
||||
function del_cache($key) {
|
||||
return C::t('cache')->delete($key);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user