insolita / yii2-opcache
Yii2 OpCache 模块 - 显示统计信息、配置、重置全部、使文件无效、在缓存文件中搜索
1.04
2017-05-19 11:19 UTC
Requires
- php: >=5.6.0
- yiisoft/yii2: *
- yiisoft/yii2-bootstrap: ^2.0
README
显示统计信息、配置、重置全部、使文件无效、在缓存文件中搜索
安装
安装此扩展的首选方法是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist insolita/yii2-opcache "~1.0"
或者将以下内容添加到您的 composer.json
文件的 require 部分。
"insolita/yii2-opcache": "~1.0"
使用方法
扩展安装完成后,只需在代码中简单使用它即可:
'bootstrap'=>[ ... \insolita\opcache\Bootstrap::class ... ], ... 'modules'=>[ ... 'opcache'=>[ 'class'=>'insolita\opcache\OpcacheModule', 'as access'=>[ 'class' => \yii\filters\AccessControl::class, 'rules' => [ [ 'allow' => true, //Protect access 'roles' => ['developer'], ], ], ] ], ... ]
访问路由 ['/opcache/default/index']
对于控制台命令的使用,在控制台配置中添加以下内容
'bootstrap'=>[ ... \insolita\opcache\Bootstrap::class ... ], ... 'controllerMap'=>[ 'opcache'=>[ 'class'=>\insolita\opcache\commands\OpcacheController::class ] ]
命令 opcache/status opcache/config opcache/files opcache/reset opcache/invalidate 将可用
屏幕截图
理解 OpCache
@see https://habrahabr.ru/company/mailru/blog/310054/ (俄语)
@see http://jpauli.github.io/2015/03/05/opcache.html (英语)
备注:
俄语设置翻译基于 https://sabini.ch/cms/perevod-nastroek-zend-opcache.html