Skip to content

On-demand Cache Revalidation

Performance in Headless architecture relies heavily on aggressive caching. Pyxis CMS ensures the site remains fast (load times <100ms) without serving stale content.

Instead of waiting for cache expiration (TTL), Pyxis CMS implements an instant notification model.

  1. Event: An editor clicks “Publish Changes” in the Filament panel.
  2. Signal: Laravel sends a POST request to the /api/revalidate endpoint on the frontend.
  3. Verification: The frontend checks if the secret from the request matches the REVALIDATE_TOKEN in its .env file.
  4. Purge: The frontend invalidates the cache for the provided path.

Upon publication, the system sends a signal using a shared security token:

Http::post("{$frontendUrl}/api/revalidate", [
'secret' => env('REVALIDATE_TOKEN'),
'path' => $record->full_url,
]);

Every Pyxis starter (Astro, Next.js) must provide an endpoint that:

  1. Accepts the POST method.
  2. Returns a 401 status if tokens do not match.
  3. Triggers the native cache-clearing function of its framework.