Files
OMS/app/base/lib/application/cache/expires.php
2025-12-28 23:13:25 +08:00

48 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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