| #pico, #cache, #solide

Cache plugin for Pico CMS

Speed up your static Pico pages with this simple cache plugin.

If you use the Pico CMS for a mostly static blog, like I do, there is no need to parse the markdown files and render the twig templates on every request. Therefore I made the Pico Cache plugin.

I did some testing and it turns out that the cache plugin speeds up the page pretty well.

With one user at a time, the average response time was 315ms without cache and 10ms with cache enabled. (97% less time)
Having 100 concurrent users, the average response time without cache was 14640ms and with cache 267ms. (98% less time)

I repeated this tests 1000 times on a fairly old macbook, so the actual values are not that convincing, but rather the response time savings in percentage.


To install the Pico Cache plugin, simply download the pico_cache.php from GitHub and put it in the plugins directory {picoInstallation}/plugins/. That's it, Pico will automatically load plugins in the plugin/ folder.

Usage and Configuration

The plugin comes with some sensible defaults, but you can of course configure them.
By default all pages except the 404 error pages are cached on the first request and saved in the {picoInstallation}/content/cache/ folder. The error pages are not cached to prevent filling up the cache folder with non existent pages. Otherwise requesting yourSite/not-existing-page-1, yourSite/not-existing-page-2,… would generate not-existing-page-1.html, … in your cache folder.
You can change the defaults, by editing your config.php file.

$config['cache_enabled'] = true; // default
$config['cache_dir'] = 'content/cache/'; // default
$config['cache_time'] = '604800'; // 60*60*24*7, seven days (default)

Set cache_enabled to false to prevent caching while developing.

To clear the cache, remove the files from the cache folder, or delete the whole cache folder.

Download Pico Cache

→ Alfred2 special characters and keyboard shortcuts extension