Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

 

Refactoring of staticpublishqueue module

This module provides the ability to generate a static HTML cache of your websites pages...

Tagged modules, caching

by Mateusz Uzdowski

Posted 24 December 2013

Read post

This module provides the ability to generate a static HTML cache of your websites pages to enhance security and performance (by serving just HTML). The module has been heavily refactored recently on the master branch (switch to 2.0 if you do not wish to upgrade). Main changes include:

  • Architectural overhaul (see below).
  • Removal of the legacy code which introduced dead execution paths and caused extension clashes.
  • Removal of some global state - URLArrayObject is now injected.
  • New pattern for subsite support: generation of multiple copies of cache into directories, one per configured domain.

Architecturally, the module is now split into two logical parts: implementers and engines. Implementers are extensions or objects which describe the desired caching behaviour via two new interfaces: StaticallyPublishable objects provide URLs to refresh, and StaticPublishingTrigger objects cause other objects to be refreshed during the engine run. Engines inspect arbitrary objects through these interfaces to find out which URLs should be refreshed.

The module provides a set of default implementations - a nightly engine to rebuild all Page objects, as well as an engine that triggers on page publishing and updates the cache partially. Assuming appropriate engines are written, the same interfaces can be used to describe caching behaviour of any object.

Module and more documentation is available from silverstripe-labs: https://github.com/silverstripe-labs/silverstripe-staticpublishqueue/

 


Mateusz has a BSc in robotics and an MSc in networking, both granted by the Polish-Japanese Institute of IT, and he has extensive experience in application and web development. After gaining all this experience and doing some freelance work, he finally arrived at the conclusion that there is no better topic to dive into than PHP development.