mutation / filecache
Cache templates to html files
Installs: 3 260
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Type:craft-plugin
Requires
- php: ^8.0.2
- craftcms/cms: ^4.0.0|^5.0.0
Requires (Dev)
- craftcms/rector: dev-main
- dev-master
- 4.0.0
- 3.0.1
- 3.0.0
- 3.0.0-beta.2
- 3.0.0-beta.1
- 2.4.1
- 2.4.0
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.7
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-develop-v3
- dev-develop-v2
- dev-feature/translations-admin-cache
- dev-feature/remove-template-caches
This package is auto-updated.
Last update: 2025-03-04 15:39:06 UTC
README
The html file cache is created automatically when you visit a page and then served when the page is visited after. The cache automatically is cleared when an element is saved, modified or deleted.
Installation
Install the plugin via the Plugin Store or by command line:
composer require mutation/filecache
php craft install/plugin filecache
Configuration
Add a file named filecache.php
to the config
folder:
<?php
return [
'*' => [
'excludedEntrySections' => [],
'excludedEntryTypes' => [],
'excludedSites' => [],
'cacheFolderPath' => 'filecache'
]
];
Exclude entries from cache by section excludedEntrySections
, type excludedEntryTypes
or site excludedSites
by adding the section/type handles to their respective arrays.
How to use
You can visit this url to clear the cache manually: /admin/utilities/clear-caches
.
You can also use these 2 console commands (@web
alias must be set to an absolute url):
php craft clear-caches/file-caches
Dynamic content
Use this template code to inject the csrf token in html:
{{ craft.filecache.injectCsrfInput() }}
Use this template code to inject the csrf token as global Javascript variables:
{{ craft.filecache.injectJsCsrfToken() }}