
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@riveo/payload-purge-cache-plugin
Advanced tools
A plugin for PayloadCMS that integrates cache purging functionalities directly into the admin panel, allowing administrators to efficiently manage and clear cached content across various platforms.
npm install @riveo/payload-purge-cache-plugin
Then register it in your payload.config.ts:
import purgeCachePlugin from '@riveo/payload-purge-cache-plugin';
import { getNextjsPurgerAction } from '@riveo/payload-purge-cache-plugin/purgers';
export const config = buildConfig({
plugins: [
purgeCachePlugin({
purgers: [
{
label: 'NextJS',
action: getNextjsPurgerAction(),
default: true,
},
],
}),
],
});
The plugin accepts an object with the following properties:
enabled: boolean
: Enable or disable the plugin. Default is true
.path?: string
: URL path for the admin page. Default is /riveo-purge-cache
.access?: AccessCallback
: Optional function to control access permissions.purgers: Purger[]
: Array of purger configurations to be triggered on cache purge.Example configuration:
purgeCachePlugin({
enabled: true,
path: '/custom-purge-cache',
access: ({ req }) => req.user.role === 'admin',
purgers: [
{
label: 'Next.js',
action: getNextjsPurgerAction(),
default: false,
},
],
});
Purges Cloudflare cache for specified zone.
Usage: getCloudflarePurgerAction({ apiKey, zoneId })
Parameters:
options
apiKey: string
- Cloudflare API keyzoneId: string
- ZoneID to purge cache forhosts?: string[]
- Optional list of hosts to purgetags?: string[]
- Optional list of tags to purgeprefixes?: string[]
- Optional list of prefixes to purge. A prefix has to include hostname but not scheme e.g.: example.com/prefixfiles?: string[]
- Optional list of specific urls to purge. An url has to include scheme, hostname and path e.g.: https://example.com/full/pathPurges internal Next.js cache.
Internally it calls revalidatePath(basePath, 'layout')
(Revalidating All Data - Next.js docs)
Usage: getNextjsPurgerAction('/')
Parameters:
basePath: string [dafault: '/']
- base path to invalidate cache for. It defaults to /
Calls specified HTTP endpoint using fetch
. Useful when your app is separate from PayloadCMS instance and exposes an endpoint to clear the cache.
Usage: getHttpPurgerAction(endpoint, options)
Parameters:
endpoint: RequestInfo
options?: RequestInit
After setting it up:
We welcome contributions! To contribute:
This project is licensed under the MIT License.
FAQs
Payload Purge Cache Plugin
We found that @riveo/payload-purge-cache-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.