@tryghost/cache-purge
v1.0.4
Published
Purge Fastly cache entries through Ghost(Pro)'s signed cache purge endpoint. Pass an HMAC key, the purge service host, and either an `id` or `domain` plus a cache `type`; the package signs the request with `@tryghost/signed-request`.
Maintainers
Keywords
Readme
Cache Purge
Purge Fastly cache entries through Ghost(Pro)'s signed cache purge endpoint.
Pass an HMAC key, the purge service host, and either an id or domain plus a
cache type; the package signs the request with @tryghost/signed-request.
Install
npm install @tryghost/cache-purge --save
or
pnpm add @tryghost/cache-purge
Usage
The package ships TypeScript types and both ESM and CommonJS builds.
ESM / TypeScript
import cachePurge from '@tryghost/cache-purge';
await cachePurge(hmacKey, 'cache.example.com', {
domain: 'example.com',
type: 'site',
source: 'admin',
});The module's single export is a callable function (it uses export =), so the
default import above requires esModuleInterop (or allowSyntheticDefaultImports).
Without those flags, import it with import cachePurge = require('@tryghost/cache-purge').
CommonJS
const cachePurge = require('@tryghost/cache-purge');
await cachePurge(hmacKey, 'cache.example.com', {
domain: 'example.com',
type: 'site',
source: 'admin',
});Develop
This is a monorepo package, managed from the repo root.
Follow the instructions for the top-level repo.
git clonethis repo &cdinto it as usual- Run
pnpm installto install top-level dependencies.
Run
pnpm --filter @tryghost/cache-purge dev
Test
pnpm --filter @tryghost/cache-purge lintruns lintpnpm --filter @tryghost/cache-purge testruns lint and tests
Copyright & License
Copyright (c) 2013-2026 Ghost Foundation - Released under the MIT license.
