webfixit/opcache
Composer 安装命令:
composer require webfixit/opcache
包简介
Allows the purge/clear/flush of the PHP OpCache via the CLI and Magento2 Backend
README 文档
README
Allows the purge/clear/flush of the PHP OpCache via the CLI and Magento2 Backend
Unmaintained
I still see a lot of activity on this repository (usage). I just wanted to note that I'm not maintaining this plugin anymore. This is because I'm not working with Magento at this point. Therefore I have no interest in making new changes/features. Though feel free to make pull-requests and I will process these.
Why
Because PHP OpCache is almost the de facto standard in current server/application setups. Most users/developers are usinga simple PHP script to clear the cache or simply ignore this cache. With this extension you can use it in your build/deployment process via the CLI. Also provided is an extension to the Magento2 backend. With a simple click you can purge the cache.
About me
I'm a DevOps engineer for a full service digital agency in the Netherlands. When possible I try to create opensource scripts / extentions and tools. If you appriciate my work, please be so kind to donate so I can keep drinking beer.
How the CLI works
It is simply not possible to clear the php OpCache via the CLI. I have created a workaround for that. Instead of actually running a static PHP file from the CLI, we do a curl request. Because it is a curl request, your webserver actually will parse this request via the "php cgi". This way we can clear it.
The issue we now have is that we do not want robots or "hackers" to be able to clear this cache. Therefor on execution we write a sort of "lock" file. Obviously removing it after clearing. This way "direct access" to this static page is not possible.
Additional cache management extended
OpCache purge
CLI Usage
php bin/magento opcache:status
Returns the opcache status:
bin/magento opcache:status
Array
(
[opcache_enabled] => 1
[cache_full] =>
[restart_pending] =>
[restart_in_progress] =>
[memory_usage] => Array
(
[used_memory] => 78587744
[free_memory] => 2068895904
[wasted_memory] => 0
[current_wasted_percentage] => 0
)
[interned_strings_usage] => Array
(
[buffer_size] => 20971520
[used_memory] => 2283208
[free_memory] => 18688312
[number_of_strings] => 41723
)
[opcache_statistics] => Array
(
[num_cached_scripts] => 1289
[num_cached_keys] => 1365
[max_cached_keys] => 130987
[hits] => 6
[start_time] => 1510859030
[last_restart_time] => 0
[oom_restarts] => 0
[hash_restarts] => 0
[manual_restarts] => 0
[misses] => 1289
[blacklist_misses] => 0
[blacklist_miss_ratio] => 0
[opcache_hit_rate] => 0.46332046332046
)
)
php bin/magento opcache:clear
Will clear the PHP OpCache
bin/magento opcache:clear Cleared OpCache
Install with Composer
composer require webfixit/opcache
webfixit/opcache 适用场景与选型建议
webfixit/opcache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26.49k 次下载、GitHub Stars 达 26, 最近一次更新时间为 2017 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 webfixit/opcache 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webfixit/opcache 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 26.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2017-11-16