npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@riveo/payload-purge-cache-plugin

v0.1.2

Published

Payload Purge Cache Plugin

Readme

Payload Purge Cache plugin

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.


Features

  • 🧹 One-click cache purge from the admin panel
  • 🔧 Pluggable purgers, with built-in support for Cloudflare, Next.js and raw HTTP request
  • 🔐 Optional access control
  • Status feedback for every purge attempt

Installation

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,
        },
      ],
    }),
  ],
});

Configuration

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,
    },
  ],
});

Built in purgers

Cloudflare

Purges Cloudflare cache for specified zone.

Usage: getCloudflarePurgerAction({ apiKey, zoneId })

Parameters:

  • options
    • apiKey: string - Cloudflare API key
    • zoneId: string - ZoneID to purge cache for
    • hosts?: string[] - Optional list of hosts to purge
    • tags?: string[] - Optional list of tags to purge
    • prefixes?: string[] - Optional list of prefixes to purge. A prefix has to include hostname but not scheme e.g.: example.com/prefix
    • files?: string[] - Optional list of specific urls to purge. An url has to include scheme, hostname and path e.g.: https://example.com/full/path

Next.js

Purges 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 /

HTTP

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

Usage

After setting it up:

  1. Go to your PayloadCMS admin panel.
  2. Click on the “Purge Cache” tab in the sidebar.
  3. Click the button to run all purgers.
  4. View real-time results for each purger.

Contributing

We welcome contributions! To contribute:

  1. Fork the Repository: Click the 'Fork' button at the top right of the repository page.
  2. Clone Your Fork: Clone your forked repository to your local machine.
  3. Create a Branch: Create a new branch for your feature or bugfix.
  4. Make Your Changes: Implement your changes and commit them with clear messages.
  5. Push to GitHub: Push your changes to your fork on GitHub.
  6. Submit a Pull Request: Open a pull request to the main repository.

License

This project is licensed under the MIT License.