API
Contents
To programmatically invalidate cache, Booster provides named tasks.
In order to use them you need to do the following steps:
-
Add the following to your
build.gradle
file:
dependencies {
include "com.enonic.xp:lib-task:${xpVersion}"
}
-
In your JavaScript controller, add a require statement:
const taskLib = require('/lib/xp/task');
The following tasks are available:
Invalidate
Invalidate (soft purge) entire or specific Content Project cache
Invalidate specific Content Project cache
const taskId = taskLib.submitTask({
descriptor: 'com.enonic.app.booster:invalidate',
config: {
project: 'sample-blog'
}
});
Invalidate entire cache
const taskId = taskLib.submitTask({
descriptor: 'com.enonic.app.booster:invalidate',
config: {
}
});
Purge All
Purge (delete) all records in cache
Purge entire cache
const taskId = taskLib.submitTask({
descriptor: 'com.enonic.app.booster:purge-all',
config: {
}
});