litespeedtech / lscache-laravel

LSCache for Laravel framework
GNU General Public License v3.0
51 stars 14 forks source link

Only LSCache::purgeAll() is working!! #22

Closed lhoucinecherif closed 2 years ago

lhoucinecherif commented 3 years ago

Hi, Am using OpenLitespeed 1.6.21 (lsphp74) in the ols-docker-env image , LSCache::purgeAll() and LSCache::purge('*') seems to be the only working functions ! When using LSCache::purge('/') or LSCache::purge('/path1,/path2,/path3') or even LSCache::purgeItems(['/path1','/path2','/path3']) nothing happens !! the pages are still served from the cache

lucasRolff commented 3 years ago

There seems to be something in OpenLiteSpeed which causes this to not function, while the purge calls do work, they purge hashes in OpenLiteSpeed that don't correspond to what the actual page has.

It's being investigated!

lucasRolff commented 3 years ago

@lhoucinecherif apparently it's expected behavior at this moment, that OLS does not support purging by URL, but only via tags.

To be able to purge, you can then either set a tag (using lstags: middleware) for your routes, this can be based on the actual URI like a tag such as /, /path1, when you then purge / or /path1 even /path1,/path2 it will purge the tags corresponding to that.

Personally, I'd probably generate a shortened checksum of the path instead, so instead of /path1 use a sha256 and using the first 6-10 characters or so (like git does for commit hashes) It's easy and consistent to calculate, and you always then work with ASCII, so no "surprises".

I'll update the README accordingly, and then let's hope OLS will bring URL purge eventually!