2017 © Pedro Peláez
 

pimcore-plugin supercache

Supercache Plugin for Pimcore

image

luklewluk/supercache

Supercache Plugin for Pimcore

  • Monday, October 31, 2016
  • by luklew
  • Repository
  • 2 Watchers
  • 4 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 3 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

SupercachePlugin

Static pages & files caching system for Pimcore., (*1)

Installation

composer require luklewluk/supercache

Also you will need to make changes in your rewrite configuration:, (*2)

Apache:

Edit your Pimcore .htaccess file by adding the following lines:, (*3)

### >>>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, (*4)

# forbid the direct access to pimcore-internal data (eg. config-files, ...), (*5)

and before, (*6)

# basic zend-framework setup see: http://framework.zend.com/manual/en/zend.controller.html, (*7)

Nginx:

Virtual host configuration:, (*8)

Replace:, (*9)

try_files $uri $uri/ /index.php?$args;

To:, (*10)

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:, (*11)

  1. Supercache - ~0.37ms, (*12)

  2. Output Cache - ~31.5ms, (*13)

  3. Pimcore without extra cache - ~79.5ms, (*14)

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:, (*15)

  1. Clean "Output Cache" (since Pimcore 4.0)
  2. Save any document or object in the Administration Panel.
  3. Delete everything inside ./plugins/Supercache/webcache except .htaccess

Also Supercache is cleaned on maintenance mode activation (since Pimcore 4.0)., (*16)

Issues

JSON response

Note: It can be useful if you want to cache JSON response as well., (*17)

Due to Pimcore/Zend good practices you suppose to encode your output to JSON by the helper with following command:, (*18)

$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:, (*19)

echo $this->_helper->json($json, false);

The Versions

31/10 2016

dev-master

9999999-dev https://github.com/luklewluk/SupercachePlugin

Supercache Plugin for Pimcore

  Sources   Download

MIT

The Requires

 

by Lukasz Lewandowski

cache caching page pimcore full fpc supercache

31/10 2016

1.1.0

1.1.0.0 https://github.com/luklewluk/SupercachePlugin

Supercache Plugin for Pimcore

  Sources   Download

MIT

The Requires

 

by Lukasz Lewandowski

cache caching page pimcore full fpc supercache

16/07 2016

1.0.0

1.0.0.0 https://github.com/luklewluk/SupercachePlugin

Supercache Plugin for Pimcore

  Sources   Download

MIT

The Requires

 

by Lukasz Lewandowski

cache caching page pimcore full fpc supercache