Search by

prestashopheaven / runtime-page-cache

georgevanengers

Asks page-cache modules (JPresta Page Cache, LiteSpeed Cache) through their hooks to forget the pages a module changed: products, categories, CMS pages or every page.

Package info

github.com/prestashopheaven/runtime-page-cache

pkg:composer/prestashopheaven/runtime-page-cache

Statistics

Installs: 130

Dependents: 0

Suggesters: 0

Stars: 0

v1.2.1 2026-12-02 02:16 UTC

This package is auto-updated.

Last update: 2026-12-02 17:04:05 UTC


README

Asks page-cache modules (JPresta Page Cache, LiteSpeed Cache) through their hooks to forget the pages a module changed: products, categories, CMS pages or every page.

Use when

A module's change shows on cached front-office pages (a block on product or category pages, a footer, a CMS page) and those pages must be refreshed in JPresta Page Cache or LiteSpeed Cache after the change (CMP-20).

Install

composer require prestashopheaven/runtime-page-cache

Usage

Run it after the change is saved, in the module's Infrastructure (an adapter of the module's own cache port):

use PrestaShopHeaven\Runtime\PageCache\PageCachePurger;

$pages = new PageCachePurger('heavenexample');
$pages->products([12, 15]);          // product pages (LiteSpeed tags P12, P15)
$pages->products([12], true);        // ... and, in JPresta, the pages that link to them
$pages->categories([4]);             // category pages (LiteSpeed tag C4)
$pages->cmsPages();                  // every CMS page (LiteSpeed: the whole public cache)
$pages->everything();                // every page: a footer, a block on every product, a module page

Without JPresta Page Cache or LiteSpeed Cache installed the hooks do nothing. Ids below 1 and repeats are skipped. In a unit test pass a closure fn (string $hook, array $params): mixed as second argument to record the requests.

Read-only split of prestashopheaven/mono-runtime-integration: changes, issues and pull requests go there. MIT License.