mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 10:55:34 +08:00
48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
||
/**
|
||
* Copyright © ShopeX (http://www.shopex.cn). All rights reserved.
|
||
* See LICENSE file for license details.
|
||
*/
|
||
|
||
|
||
class base_application_cache_expires extends base_application_prototype_filepath
|
||
{
|
||
var $path = 'dbschema';
|
||
|
||
/**
|
||
* install
|
||
* @return mixed 返回值
|
||
*/
|
||
public function install()
|
||
{
|
||
$dbschema = $this->getPathname();
|
||
if(is_file($dbschema)){
|
||
require($dbschema);
|
||
foreach($db AS $key=>$val){
|
||
if($val['ignore_cache'] !== true){
|
||
$data['type'] = 'DB';
|
||
$data['app'] = $this->target_app->app_id;
|
||
$data['name'] = strtoupper($this->target_app->app_id . "_" . $key);
|
||
$data['expire'] = time();
|
||
kernel::log('Installing Cache_Expires DB:'. $data['name']);
|
||
app::get('base')->model('cache_expires')->replace($data,
|
||
array('type'=>$data['type'],'app'=>$data['app'],'name'=>$data['name'])
|
||
);
|
||
}
|
||
break;
|
||
}
|
||
kernel::log('UPDATE CACHE EXPIRES KV DATA');
|
||
cachemgr::store_vary_list(cachemgr::fetch_vary_list(true)); //更新kv
|
||
}
|
||
}//End Function
|
||
|
||
function clear_by_app($app_id){
|
||
if(!$app_id){
|
||
return false;
|
||
}
|
||
app::get('base')->model('cache_expires')->delete(array(
|
||
'app'=>$app_id));
|
||
}
|
||
|
||
}//End Class
|