Manual Cache Cleaning

How to manually flush the cache

Illustration of a man on a step ladder wiping a computer monitor

The skeleton app has a dependency on laminas/laminas-cli, which is primarily a conventional way of aggregating multiple Symfony Console based commands in a modular fashion. The skeleton itself currently ships with one useful command named "primo:clear-cache".

Laminas cli installs a script in your configured bin directory (./vendor/bin usually)

Issuing the command in your terminal will yield a list of available tools:

$ vendor/bin/laminas

To flush all of the caches, issue $ vendor/bin/laminas primo:clear-cache. This will clear the page cache as well as the cache for Prismic API queries.

About the Cache Pools

There are 2 cache pools setup to begin with, one for the HTML responses delivered by the app and one for API responses returned by your Prismic content repository. Both of these pools will be PSR-6 Cache Pools.

You can configure the cache pools in any way you like, at the time of writing, the cache library used was Laminas Cache but it is trivial to swap this out for another library such as Symfony Cache thanks to PSR-6. Also, you can of course change the cache backend to anything that's supported by your caching library of choice. In production, I will typically use a central Redis server or cluster so that each application instance can share the same cache.

Both of the pools can be located in your DI container by marker interfaces:

assert($container instanceof \Psr\Container\ContainerInterface);

$pageCache = $container->get(\App\Cache\PageCache::class);
$apiCache = $container->get(\App\Cache\PrismicCache::class);

It is unlikely that you'd want to clear one pool and not the other in general usage, that's why the cli tool has no options or arguments. If you disagree, open an issue and/or provide a pull request.