[Resolved] LS cache purge all php script

#1
In the Wordpress lightspeed cache plugin there is a purge all cache button. I would love to integrate a similar function in a plugin for Craft cms. I already found a solution to purge the cache of a single page (https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:no-plugin-advanced:purge). With this solution i can loop trough all page entry url's and purge them one by one. But i think, there should be a much simpler and faster solution. I tryed to understand the wordpress plugin, but i dont...
Does anyone have a simple purge all php script?
 

KevinFwu

Administrator
Staff member
#2
Hi @tombauer

Do you currently have a plugin that you're looking to integrate the litespeed cache logic into?

If that's the case, the easiest way would be to add a simple cache response header and purge response headers.
For example:
When caching:
X-LiteSpeed-Tag: CC
X-LiteSpeed-Cache-Control: public,max-age=3600

When purging:
X-LiteSpeed-Purge: CC

Any pages with the X-LiteSpeed-Tag header will be cached with those tags. Then, when you send back a X-LiteSpeed-Purge header, pages with those tags will be purged. There's more detail about this here

Let us know if you have any further questions/comments about this!

Cheers,
Kevin
 
Top