AbanteCart Community
eCommerce construction => Installation and Configuration => Topic started by: barry819 on December 04, 2024, 02:30:32 PM
-
Is there a setting to peridoically clear cache?
here's the problem: my hosting package sets a limit on iNodes. Cache consumes iNodes, and as a result peridoically my site gets disabled (customers cannot place orders because they cannot add items to a shopping cart) unless I go in and manually clear all the site cache.
I'm on 1.3.3, and the cache clear function is only manual, there's no way to set the site to clear cache based on some time frame (daily, weekly, monthly, whatever).
Is there a setting somewhere that I have missed that would resolve this? Or an extension that could perform a periodic clear?
-
Hello.
First, you need a script that will delete the cache files. For example a simple shell or php script. Upload the clear_cache.sh script to your server. Now, you need to set up a cron job in your hosting panel to run this script at regular intervals.
-
Hoping this message still gets some recognition. As this post is relevant to the problem we have with inodes filling up on our hosting site. However the script in this message is not a link just text. Anyone know where we can find this clear_cache.sh ?
Thank You,
-
Hoping this message still gets some recognition. As this post is relevant to the problem we have with inodes filling up on our hosting site. However the script in this message is not a link just text. Anyone know where we can find this clear_cache.sh ?
Thank You,
Hello.
Can you tell which version of AbanteCart you're using and the number of products you have?
You can create the clean_cache.php script like this
<?php
// File: /home/public_html/clean_cache.php
$cacheDir = __DIR__ . '/system/cache';
// Ensure the directory exists
if (!is_dir($cacheDir)) {
exit("Cache directory not found: $cacheDir\n");
}
$files = scandir($cacheDir);
foreach ($files as $file) {
// Keep index.html and skip . / ..
if ($file === '.' || $file === '..' || $file === 'index.html') {
continue;
}
$filePath = $cacheDir . '/' . $file;
if (is_file($filePath)) {
unlink($filePath);
} elseif (is_dir($filePath)) {
deleteDirectory($filePath);
}
}
// Recursive deletion function
function deleteDirectory($dir) {
$items = array_diff(scandir($dir), ['.', '..']);
foreach ($items as $item) {
$path = "$dir/$item";
is_dir($path) ? deleteDirectory($path) : unlink($path);
}
return rmdir($dir);
}
and set a CRON job to run it like
*/6 * * * * /usr/bin/php /home/public_html/clean_cache.php >/dev/null 2>&1
-
Thank you. I am not dev person, but will do my best to try this.....
-
Ambil langkah pertama menuju kemenangan besar dengan mendaftar hari ini!