daoandco/cakephp-cachecleaner
Composer 安装命令:
composer require daoandco/cakephp-cachecleaner
包简介
CacheCleaner plugin for CakePHP, this shell clean the cache of your application.
README 文档
README
This plugin is a shell that cleans the cache in your application
Requirements
- PHP version 5.4.16 or higher
- CakePhp 3.0 or higher
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require daoandco/cakephp-cachecleaner
Loading the Plugin
// In config/bootstrap.php Plugin::load('CacheCleaner', ['bootstrap' => true, 'routes' => false]);
Quick Start
Clear all cache
bin/cake CacheCleaner.clear -a
Clear cake cache
bin/cake CacheCleaner.clear cake
Tasks
ORM
It's the equivalent to orm_cache clear. See more informations
bin/cake CacheCleaner.clear orm
Cake
Clear the cache generate by Cake\Cache\Cache
bin/cake CacheCleaner.clear cake
Opcache
Resets the entire opcode cache, See more informations
bin/cake CacheCleaner.clear opcache
Dir
Clear directories in "tmp/cache/"
- Clear all directories
bin/cake CacheCleaner.clear dir -a
- Clear one directory
bin/cake CacheCleaner.clear dir dir_name
- Clear many directories
bin/cake CacheCleaner.clear dir dir_name other_dir_name
Configuration
Create config file
Create a file in app/config like 'vendor/daoandco/cakephp-cachecleaner/config/config.php'
<?php // config/cachecleaner.php return [ 'CacheCleaner' => [ 'tasks' => ['CacheCleaner.Dir', 'CacheCleaner.Orm', 'CacheCleaner.Cake', 'CacheCleaner.Opcache'], 'Dir' => [ 'dirs' => true, ], ] ];
Load configuration
<?php // In config/bootstrap.php Configure::load('cachecleaner', 'default');
Options
- tasks : add or remove tasks Exemple : if you do not want Opcache you can write
tasks' => ['CacheCleaner.Dir', 'CacheCleaner.Orm', 'CacheCleaner.Cake'],
- Dir.dirs : choose the folders to clear
Exemple : if you want clear only
persistentforler you can write
'Dir' => [ 'dirs' => ['persistent'], ],
Create a new task for your usage
You can add your own tasks, Your class must implement Task Interface
Create the task
// In Shell/Task namespace App\Shell\Task; use Cake\Console\Shell; use Cake\Console\ConsoleOptionParser; use CacheCleaner\Shell\Task\TaskInterface; class DemoTask extends Shell implements TaskInterface { public function getOptionParser() { $parser = new ConsoleOptionParser('console'); $parser ->description("Task description") ->command("demo") ; return $parser; } public function help() { return 'Task description'; } public function main() { // call with de command : "bin/cake CacheCleaner.clear demo" $this->success('OK'); } public function all() { // call with de command : "bin/cake CacheCleaner.clear demo -a" $this->success('OK'); } }
Load the task
<?php // In config/cachecleaner.php return [ 'CacheCleaner' => [ 'tasks' => ['CacheCleaner.Dir', 'CacheCleaner.Orm', 'CacheCleaner.Cake', 'CacheCleaner.Opcache', 'Demo'], 'Dir' => [ 'dirs' => true, ], ] ];
daoandco/cakephp-cachecleaner 适用场景与选型建议
daoandco/cakephp-cachecleaner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 586 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 daoandco/cakephp-cachecleaner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 daoandco/cakephp-cachecleaner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 586
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-04-15