Cache Clear
Clay Kiln Plugin to Clear Fastly Cache
Requirements
The Kiln project that is going to use this plugin should set the following environment variable:
FASTLY_API_KEY=cool-api-key
If FASTLY_API_KEY
is not provided, the plugin will fall back to making unauthenticated HTTP requests
with the PURGE
method. This is a good option if using IP origin rules for allowing purges.
Getting Started
- Install the package as a dependency
npm install --save cache-clear
- Create a directory for your plugin inside the kiln/plugins directory in the services section
mkdir PROJECT_DIRECTORY/app/services/kiln/plugins/PLUGIN_NAME
- Create an
index.js
file in the previous directory created, importing main components for the plugin and setting them in the specific window.kiln
object.
const {
NavButton,
NavContent,
CacheClearPlugin
} = require('cache-clear');
module.exports = () => {
window.kiln.navButtons['cache-clear'] = NavButton;
window.kiln.navContent['cache-clear'] = NavContent;
window.kiln.plugins['cache-clear'] = CacheClearPlugin;
};
- At
app/services/kiln/index/js
require the previously created file
require('./plugins/cache-clear')();