
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
payload-cached
Advanced tools
payload-cached manages cache invalidation for your Payload CMS collections.
Features
# pnpm
pnpm add payload-cached
# yarn
yarn add payload-cached
# npm
npm install payload-cached
Add the plugin to your payload.config.ts:
import { buildConfig } from "payload";
import { cachedPlugin } from "payload-cached";
export default buildConfig({
collections: [Posts, Categories, Users],
plugins: [
cachedPlugin({
collections: {
posts: ["create", "update", "delete"],
categories: ["create", "update"],
// users: false, // Disable tracking for users
},
publishHandler: async (changes) => {
// Optional: Custom handler for published changes
console.log("Published changes:", changes);
},
}),
],
});
The plugin automatically adds a Publish button to your admin panel header. Click it to process all queued changes and invalidate cache tags.
You can also trigger publishing programmatically:
Node.js:
import config from "@payload-config";
import { getPayload } from "payload";
const payload = await getPayload({ config });
const response = await fetch(`${process.env.PAYLOAD_API_URL}/cache-plugin/publish`, {
method: "POST",
});
Edge runtime:
const response = await fetch(`${process.env.PAYLOAD_API_URL}/cache-plugin/publish`, {
method: "POST",
});
The cachedPlugin accepts the following configuration:
| Option | Default | Description |
|---|---|---|
collections | All collections tracked | Per-collection configuration for which operations to track |
publishHandler | - | Optional callback function called after changes are published |
You can configure tracking per collection:
cachedPlugin({
collections: {
// Track all operations (create, update, delete)
posts: ["create", "update", "delete"],
// Track only updates
categories: ["update"],
// Disable tracking completely
users: false,
// Use default operations (create, update, delete)
// If not specified, defaults to all operations
},
})
Change Tracking: When documents are created, updated, or deleted, the plugin automatically adds them to a publish queue.
Dependency Resolution: When publishing, the plugin analyzes relationships between collections and invalidates cache tags for dependent documents.
Cache Invalidation: Uses Next.js revalidateTag to invalidate cache tags for affected collections.
Publish Queue: Changes are queued until you explicitly publish them, allowing you to batch invalidations.
Here's a complete example showing how to integrate payload-cached:
// payload.config.ts
import { buildConfig } from "payload";
import { cachedPlugin } from "payload-cached";
import { Posts } from "./collections/Posts";
import { Categories } from "./collections/Categories";
export default buildConfig({
collections: [Posts, Categories],
plugins: [
cachedPlugin({
collections: {
posts: ["create", "update", "delete"],
categories: ["update"], // Only track updates for categories
},
publishHandler: async (changes) => {
// Optional: Send webhook, update external cache, etc.
await fetch("https://api.example.com/webhook", {
method: "POST",
body: JSON.stringify(changes),
});
},
}),
],
});
// app/api/revalidate/route.ts
import { NextRequest, NextResponse } from "next/server";
import config from "@payload-config";
import { getPayload } from "payload";
export async function POST(request: NextRequest) {
const payload = await getPayload({ config });
const response = await fetch(
`${process.env.PAYLOAD_API_URL}/cache-plugin/publish`,
{
method: "POST",
}
);
if (!response.ok) {
return NextResponse.json(
{ error: "Failed to publish changes" },
{ status: 500 }
);
}
return NextResponse.json({ success: true });
}
The plugin provides two endpoints:
/cache-plugin/publishPublishes all queued changes and invalidates cache tags.
Response:
200 OK - Changes published successfully200 OK with message "No changes to publish" - Queue is empty/cache-plugin/checkChecks the status of the publish queue.
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build the plugin
pnpm build
# Run tests
pnpm test
MIT
FAQs
Payload Plugin for Cached Data
The npm package payload-cached receives a total of 0 weekly downloads. As such, payload-cached popularity was classified as not popular.
We found that payload-cached 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.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.