选择语言 :

 Module_Cache::check_file_config

检查文件缓存配置

null Module_Cache::check_file_config( string $name )
throws
Exception

参数列表

参数 类型 描述 默认值
$name string $name
File: ./modules/cache/cache.class.php
protected function check_file_config($name)
{
    if (null===$name)
    {
        $name = Cache::DEFAULT_CONFIG_NAME;
    }

    # 缓存类型为文件缓存
    $write_mode = Core::config('core.file_write_mode');

    if (preg_match('#^(db|cache)://([a-z0-9_]+)/([a-z0-9_]+)$#i', $write_mode , $m))
    {
        $new_config = $m[2];

        if ($m[1]=='db')
        {
            $driver = Cache::DRIVER_DATABASE;

            $this->load_config($new_config);
        }
        elseif ($driver=='cache')
        {
            # 仍旧是缓存配置
            if ($name===$new_config)
            {
                throw new Exception(__('core config file_write_mode error.'));
            }
            else
            {
                $this->load_config($new_config);

                if ($this->config['driver']==Cache::DRIVER_FILE)
                {
                    # 读取的配置仍旧是文件缓存
                    throw new Exception(__('core config file_write_mode error.'));
                }
            }
        }

        $this->config['prefix'] = $m[3];
    }
}