文件缓存

 


 

配置选项

$options = [
    'path'          => CACHE_PATH,
    'expire'        => 0,
    'sub_dir'       => '', //子目录
    'use_random_dir'   => false, //随机子目录
    'path_level'    => 0,
    'prefix'        => '',
    'length'        => 0,
    'data_compress' => false,
];

 

设置配置项

一、配置文件配置

 

return [

    'url' => array(
        'mode' => 2,
        'join' => '/',
        'ext' => '/',
    ),

    'cache' => [
        'path' => ROOT_PATH . 'runtime' . DR,
        'sub_dir' => 'foo/bar',
    ]
];

 

二、动态配置

 

Cache::options('path', ROOT_PATH . 'runtime' . DR);
Cache::options('sub_dir', 'foo/bar');