opxcore/config-cache-files
Composer 安装命令:
composer require opxcore/config-cache-files
包简介
The OpxCore config cache file driver.
README 文档
README
Installing
composer require opxcore/config-cache-files
Standalone usage:
use OpxCore\Config\ConfigCacheFiles; $configFiles = new ConfigCacheFiles($path);
Usage with container
use OpxCore\Config\Interfaces\ConfigCacheInterface; use OpxCore\Config\ConfigCacheFiles; $container->bind( ConfigCacheInterface::class, ConfigCacheFiles::class, ['path' => $path] ); $configCache = $container->make(ConfigCacheInterface::class); // or $container->bind(ConfigCacheInterface::class, ConfigCacheFiles::class); $configCache = $container->make(ConfigCacheInterface::class, ['path' => $path]);
Where $path is absolute path to folder with configuration cache files.
Loading config cache
$loaded = $configCache->load($config, $profile)
Loads array of configurations from path given in a constructor. If $profile is not set driver will search file with
name config.cache, in other case name will be config.given_profile.cache. If file exists and not expired (this
option stored inside file) array of configuration will be loaded to $config variable and true would be returned as
function return value. In all other cases function returns false and $config variable would be not affected.
Saving config cache
$configCache->save($config, $profile, $ttl)
Saves $config array to file (see loading). $ttl is time to live for cached data in seconds.
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-02