Menú

How To Set Up Cronjob To Automatically Clear Cache

In this guide, we'll show you how to set up a cronjob for the Super Speed module to automatically clear expired page caches. By following these steps, you'll ensure your website runs smoothly, visitors always see the latest content, and your server isn't cluttered with outdated cache files.

Why Setting Up a Cronjob Is Important

When a cache file expires according to its set duration, if a user visits that page then a new cache file will be created and the expired cache file will be deleted at the same time.

If no new users visit that page, the expired file won't automatically delete itself. To manage this, you should set up a cronjob to clear these unused files and free up server space. If a user accesses a page with no existing cache because the old file was cleared and not yet replaced, a new cache file is generated at that visit.

Therefore, whether your content is current or outdated depends on how long the page cache is set to last, not on whether the expired cache file is deleted. If a cache file expires and nobody visits the page, it stays on the server until a cronjob deletes it, because expired cache files don't delete themselves.

To keep your website performing at its best, you'll want to set up a cronjob to automatically clear expired cache files. This way, you don't have to worry about old cache files taking up space or visitors seeing outdated content. In the following steps, we'll show you how to set up a cronjob for the Super Speed module, ensuring that your cache management is efficient and your website stays up-to-date.

  

How to Set Up Cronjob for Super Speed Module

Follow these steps to set up a cronjob for Super Speed:

Step 1: From the Super Speed module configuration page, go to the "Help" section.

Step 2: In section (7), you'll find the command for setting up a cronjob on your server. Copy the command and the "Cronjob secure token", then paste it into your cronjob setup in cPanel or the server management tool you're using.

After saving the cronjob settings, run it to ensure it's working correctly.

 

NOTE: We recommend setting the cronjob to run once every hour to clear page cache and maintain optimal performance.

 

Step 3: If you want to manually clear the page cache, click the "Execute cronjob manually" button.

 

If you need more detailed instructions on setting up a cronjob, please refer to our guide here

 

Conclusion

Setting up a cronjob to automatically clear expired page caches is a crucial step in maintaining a well-functioning website. It helps ensure visitors always see fresh content and that your server stays clean and efficient. Follow the steps above to set up your cronjob, and enjoy a faster, more reliable website.

Recuento de vistas: 1111 vistas