Lscache Purging issue in laravel

#1
Hello Everyone ,

i have implemented the lscache in one of my laravel application but there is some issue with the purging and hit the private cache. Initially routes are hit the private cache but whenever i made the post request then it's clearing all the caches , bellow is the code which i have used for same

.htaccess


Code:
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    <IfModule LiteSpeed>
        CacheLookup on
        RewriteEngine On
        RewriteCond %{REQUEST_METHOD} POST
        RewriteRule .* - [E=Cache-Control:no-cache]
    </IfModule>
</IfModule>

Laravel Routes


PHP:
Route::get('/view-staff', 'StaffController@viewStaff')->middleware(['permission:View Global Staff List','lscache:max-age=86400;private;esi=off','lstags:public:global']);
            Route::get('/{id}/edit-global-staff', 'StaffController@editStaff')->middleware(['permission:Edit Global Staff','lscache:no-cache']);
            Route::post('/{id}/update-global-staff', 'StaffController@updateStaff')->middleware(['permission:Edit Global Staff','lscache:no-cache']);

initially when i check the console then it's showing like hit.private that means it's stored the cache , but when i made a post request and while post request i am not purging any cache but still it's clearing all the cache

any one please help me to resolve for the same
 

serpent_driver

Well-Known Member
#2
I can't give you any specific information about LAravel because I have no experience with Laravel, but the basic principle of LScache is the same for all CMS.

Excluding POST requests from caching is obsolete because POST requests are not cached by default. From your code shown there is no reference to the fact that the cache would be purged for POST requests, because purging requires a specific purge command and this is also missing in your code.
 
Top