Saves the result of a f::read()
request in Kirby's local cache folder. If the cache is not expired, subsequent requests will be served from the local filesystem.
- $url (string)
The path for the request - $expires (int)
Number of seconds until the cache expires (optional; defaults to 1 hour)
- Clone or download this repository.
- Unzip the archive if needed and rename the folder to
getcached
.
Make sure that the plugin folder structure looks like this:
site/plugins/getcached/
If you know your way around Git, you can download this plugin as a submodule:
$ cd path/to/kirby
$ git submodule add https://github.com/samnabi/getcached site/plugins/getcached
Use getCached()
as a drop-in replacement for Kirby's f::read()
or PHP's file_get_contents()
.