luklewluk/supercache
Composer 安装命令:
composer require luklewluk/supercache
包简介
Supercache Plugin for Pimcore
README 文档
README
Static pages & files caching system for Pimcore.
Installation
composer require luklewluk/supercache
Also you will need to make changes in your rewrite configuration:
####Apache:
Edit your Pimcore .htaccess file by adding the following lines:
### >>>SUPERCACHE PLUGIN
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD) [OR]
RewriteCond %{QUERY_STRING} !^$
RewriteRule . - [S=3]
RewriteCond %{DOCUMENT_ROOT}/plugins/Supercache/webcache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) %{DOCUMENT_ROOT}/plugins/Supercache/webcache/%{HTTP_HOST}/$1/index.html [L]
RewriteCond %{DOCUMENT_ROOT}/plugins/Supercache/webcache/%{HTTP_HOST}/$1/index.js -f
RewriteRule ^(.*) %{DOCUMENT_ROOT}/plugins/Supercache/webcache/%{HTTP_HOST}/$1/index.js [L]
RewriteCond %{DOCUMENT_ROOT}/plugins/Supercache/webcache/%{HTTP_HOST}/$1/index.bin -f
RewriteRule ^(.*) %{DOCUMENT_ROOT}/plugins/Supercache/webcache/%{HTTP_HOST}/$1/index.bin [L]
### <<<SUPERCACHE PLUGIN
It should be located after
# forbid the direct access to pimcore-internal data (eg. config-files, ...)
and before
# basic zend-framework setup see: http://framework.zend.com/manual/en/zend.controller.html
####Nginx:
Virtual host configuration:
Replace:
try_files $uri $uri/ /index.php?$args;
To:
try_files /plugins/Supercache/webcache/$http_host/$request_uri/index.js /plugins/Supercache/webcache/$http_host/$request_uri/index.html $uri $uri/ /index.php?$args;
Some tests
Simple Pimcore blog and request time (TTFB) per page:
-
Supercache - ~0.37ms
-
Output Cache - ~31.5ms
-
Pimcore without extra cache - ~79.5ms
Cache cleaning
Currently any change clean the cache. It turned out to be the best solution especially if someone wants to use Supercache in really complex website with many object-document dependencies. If you want to clean cache manually you can do it by one of method below:
- Clean "Output Cache" (since Pimcore 4.0)
- Save any document or object in the Administration Panel.
- Delete everything inside ./plugins/Supercache/webcache except .htaccess
Also Supercache is cleaned on maintenance mode activation (since Pimcore 4.0).
Issues
JSON response
Note: It can be useful if you want to cache JSON response as well.
Due to Pimcore/Zend good practices you suppose to encode your output to JSON by the helper with following command:
$this->_helper->json($json);
Unfortunately your response won't be cached because shutdown event can't be called. The easiest solution is replace it to:
echo $this->_helper->json($json, false);
luklewluk/supercache 适用场景与选型建议
luklewluk/supercache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 07 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「page」 「cache」 「caching」 「fpc」 「full」 「pimcore」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 luklewluk/supercache 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 luklewluk/supercache 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 luklewluk/supercache 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.
repository php library
Plug-ins for DataTables
Query caching for Laravel 5
This package helps you use bitwise enums in PHP and Laravel.
Laravel 5 - Repositories to the database layer
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-16