Auto clear litespeed cache at 12:30am?

#1
I use litespeed for opencart v3.0.3.2 and am trying to figure out a way to clear the cache automatically around 12:30 am as I have new products that drop every night at midnight. I'm setting up facebook stories to advertise them via a schedule so need to make sure the cache is cleared so the link in the stories works to show the new products as well as there being seen on the homepage latest products module. I've been searching for clearing it via a cron job or something like that, but haven't been able to find anything. Is there a way to do this???
 

serpent_driver

Well-Known Member
#2
Create a blank PHP page, place it in root directory where OC is installed and copy the code below into this PHP file. This purges the cache for the domain where OC is installed, but not the entire cache on your server.

PHP:
<?php
$tag = substr(md5(__DIR__ . '/system/library/lscache'),0,4);
header("X-LiteSpeed-Purge:" . $tag);
 
Last edited:
#4
also I assume the full code would be

Code:
<?php
$tag = substr(md5(__DIR__ . '/system/library/lscache'),0,4);
header("X-LiteSpeed-Purge:" . $tag);
?>
 
#5
Create a blank PHP page, place it in root directory where OC is installed and copy the code below into this PHP file. This purges the cache for the domain where OC is installed, but not the entire cache on your server.

PHP:
<?php
$tag = substr(md5(__DIR__ . '/system/library/lscache'),0,4);
header("X-LiteSpeed-Purge:" . $tag);
Thanks! I created a file with the code you gave me in my root directory called clear.php but have limited experience using cron. Do I just use the command like this?

php /home/USER/public_html/clear.php

set to run every day at a little after midnight?
 
#12
I have never done anything with curl. Do I put this line in my cron job list???

I tried putting in in cron job and this is the message I got back so I do not think it worked.

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0<!DOCTYPE html>
<html style="height:100%">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <title> 301 Moved Permanently </title></head> <body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; "> <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
<h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">301</h1>
<h2 style="margin-top:20px;font-size: 30px;">Moved Permanently </h2> <p>The document has been permanently moved.</p> </div></div></body></html>

100 707 100 707 0 0 20320 0 --:--:-- --:--:-- --:--:-- 22093

I tried to run it in my browser just with the "http:...." part and got

You don't have authorization to view this page.


HTTP ERROR 403
 
Last edited:

AndreyPopov

Well-Known Member
#15
#16
Top