Download the PHP package timnarr/kirby-snippet-cache without Composer
On this page you can find all versions of the php package timnarr/kirby-snippet-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timnarr/kirby-snippet-cache
More information about timnarr/kirby-snippet-cache
Files in timnarr/kirby-snippet-cache
Package kirby-snippet-cache
Short Description This plugin provides caching functionality for Kirby CMS snippets.
License MIT
Homepage https://github.com/timnarr/kirby-snippet-cache
Informations about the package kirby-snippet-cache
Kirby Snippet Cache
This plugin provides caching functionality for Kirby CMS snippet output via a snippet-cache
snippet.
It may be useful if you can't use Kirby's overall page cache, but have snippets that do extensive queries or loop and transform a lot of data.
Installation
Download
Download and copy this repository to /site/plugins/kirby-snippet-cache
.
Composer
Usage
No usage with slots
⚠️ Unfortunately, passing slots to cached snippets is not supported and probably never will be.
Take a look at the following example of what a cached snippet with slots would look like. This would cache the snippet output, but also execute the slotted PHP each time, and if you are doing extensive tasks here (here using sleep(4)
as an example), this would not provide any performance benefits.
Clear cache
All caches are automatically cleared when an site (using the page.update:after
hook) or page update (using the site.update:after
hook) happens.
Options
Option | Default | Description |
---|---|---|
duration |
0 |
Default cache duration in minutes. Can be defined per snippet. 0 means infinite cache duration. |
Set options in your config.php
file:
License
MIT License Copyright © 2023 Tim Narr