Kirby Cache REST

Cache (file cache) operations made developer friendly, in Kirby CMS.

Github: https://github.com/jenstornell/kirby-cache-rest

Just visit an url to make a cache operation, for example /flush. You will get a JSON response back. It’s simple for both users and computers to read the results.

{
    "roots": [
        {
            "count": 23,
            "root": "path/to/cache",
            "success": true
        },
        {
            "count": 12,
            "root": "path/to/thumbs",
            "success": false
        }
    ],
    "success": false,
    "flushed_files": 21
}

At the moment there is only the flush operation but in time there may be more.

Future ideas

  • /stats - Get information about the cached files, how many there are, if it’s active etc.
  • /regenerate - Loop through all the pages and trigger the cache to save them. May not be the best operation for very large sites.
  • /delete/about - Delete a cache for a particular page, but keep the rest.
1 Like