276

Product support

Read the plugin support instructions.

Categories

This page in Russian with all instructions.

Static files cache system

Lightning-fast cache system that converts your website page to static HTML files. Super useful for anyone who wants their static website to be faster.

Notes

Work in progress.

This plugin caches every route that opens by GET parameter with 200 response code. Except for every URL that is matching your 'backendUri' defined in config/cms.php.


© 2019, Biz-Mark under the MIT license.

Adaptation for OctoberCMS by Nick Khaetsky at Biz-Mark.

Russian OctoberCMS developer community OctoClub.ru

Installation

Open Settings in the control panel of your OctoberCMS website. Go to Updates & Plugins and in search bar type "Quicksilver". Install it by clicking on the icon.

Configuration

  1. Open .htaccess and add the following before Standard routes section

    ##
    ## Serve Cached Page If Available
    ##
    RewriteCond %{REQUEST_URI} ^/?$
    RewriteCond %{DOCUMENT_ROOT}/storage/page-cache/pc__index__pc.html -f
    RewriteRule .? /storage/page-cache/pc__index__pc.html [L]
    RewriteCond %{DOCUMENT_ROOT}/storage/page-cache%{REQUEST_URI}.html -f
    RewriteRule . /storage/page-cache%{REQUEST_URI}.html [L]
    RewriteCond %{HTTP:X-Requested-With} XMLHttpRequest
    RewriteRule !^index.php index.php [L,NC]
  2. Comment out following line in White listed folders section.

    RewriteRule !^index.php index.php [L,NC]
  3. Be sure that plugin can create/write/read "page-cache" folder in your storage path.

Ignoring the cached files

To make sure you don't commit your locally cached files to your git repository, add this line to your .gitignore file:

/storage/page-cache

Clearing the cache

Since the responses are cached to disk as static files, any updates to those pages in your app will not be reflected on your site. To update pages on your site, you should clear the cache with the following command:

php artisan page-cache:clear

As a rule of thumb, it's good practice to add this to your deployment script. That way, whenever you push an update to your site the page cache will automatically be cleared.

If you're using Forge's Quick Deploy feature, you should add this line to the end of your Deploy Script. This'll ensure that the cache is cleared whenever you push an update to your site.

You may optionally pass a URL slug to the command, to only delete the cache for a specific page:

php artisan page-cache:clear {slug}

Customizing what to cache

By default, all GET requests with a 200 HTTP response code are cached. If you want to change that, create your own middleware that extends the package's base middleware, and override the shouldCache method with your own logic.

Example:

<?php namespace Acme\Plugin\Middleware;

use Request;
use Response;

use BizMark\Quicksilver\Classes\Middleware\CacheResponse as BaseCacheResponse;

class CacheResponse extends BaseCacheResponse
{
    protected function shouldCache(Request $request, Response $response)
    {
        // In this example, we don't ever want to cache pages if the
        // URL contains a query string. So we first check for it,
        // then defer back up to the parent's default checks.
        if ($request->getQueryString()) {
            return false;
        }

        return parent::shouldCache($request, $response);
    }
}

Update the Plugin.php of BizMark\Quicksilver and pass your new CacheResponse class to pushMiddleware() method.

Don't forget to freeze all updates of Quicksilver plugin at settings of your OctoberCMS website. Otherwise all your changes in Plugin.php file will be overwritten by next update from marketplace.


© 2019, Biz-Mark under the MIT license.

Developed by Joseph Silber, adapted for OctoberCMS by Nick Khaetsky at Biz-Mark.

  • Found the plugin useful on 6 Jan, 2020

    OMG! This is very cool! This plugin saved me from torment! Thanks!

    sorry a lot of emotions

  • author

    Replied on 9 Jan, 2020

    We are pleased to know that our plugin helped you! Thank you for using it!

1.3.0

!!! Query strings filtering for dynamic pages.

Nov 21, 2019

1.2.2

Minor fixes

Nov 21, 2019

1.2.1

Fixing typo in russian localization

Nov 20, 2019

1.2.0

!!! New ReportWidget for dashboard that allows quiclky purge pages cache and october cache.

Nov 20, 2019

1.1.6

Fixing backend opening error

Oct 09, 2019

1.1.5

!!! Ajax requests now work properly on cached pages. Place new code in your htaccess like in documentation

Aug 19, 2019

1.1.1

Note about AJAX on cached pages in README

Aug 19, 2019

1.1.0

!!! Updated configuration section in README. To actually use power of this plugin please configure it.

Jul 12, 2019

1.0.1

Removed routes.php file

Jul 12, 2019

1.0.0

First version of Quicksilver

Jul 02, 2019

Upgrading To 1.4

if you have 1.3 version, just delete this two rows in .htaccess of your project

RewriteCond %{QUERY_STRING} ^(.)
RewriteRule !^index.php index.php [L,NC]