SiteHost

Working with the SilverStripe Caching folder

Silverstripe is a versatile content management system (CMS) that empowers you to build and manage websites with ease.

Why Create the silverstripe-cache Folder?

The silverstripe-cache folder serves a crucial purpose in your Silverstripe project. Here's why it's important:

Optimised Performance: Silverstripe generates and stores various temporary files to enhance performance and provides a better user experience. By creating a dedicated silverstripe-cache folder, you ensure that these files are organised and don't clutter other system directories, like the /tmp folder, which can lead to performance issues.

Easier Maintenance: Having a separate cache folder makes it easier to manage and clean up temporary files when necessary. It's especially valuable when troubleshooting or upgrading your Silverstripe installation.

Prevent Server Overload: If your temporary files accumulate in system-wide directories, it can lead to server overload, slowed performance, or even crashes. Isolating Silverstripe's cache files helps maintain a healthy server environment.

How to Create the silverstripe-cache Folder:

Creating the silverstripe-cache folder is a straightforward process. Follow these steps:

Step 1: Access Your Container:

In this step, we need to ssh into the Container with the SSH user attached to the container.

Step 2: Navigate to Your Silverstripe Project Directory:

Using your terminal, navigate to the root directory of your Silverstripe project. This is where your project's primary files are located, usually this should be the /container/application/ folder.

$cd /container/application/

Step 3: Create the silverstripe-cache folder:

In the project root directory, create a new folder, say silverstripe-cache. You can use this handy command:

$ mkdir silverstripe-cache

and assign it with the preferred permissions

$ chmod 0777 silverstripe-cache

Step 4: Add your new cache directory to your .env file

Edit your .env file in your /contianer/application directory and add the following line;

SS_TEMP_PATH="/container/application/silverstripe-cache"

Step 5: Restart your container

For Silverstripe to get the new changes, we need to restart the Container, you can do this via the Restart option on the SiteHost Control Panel.

Step 6: You are Done!

Your silverstripe-cache folder is now in place and ready to serve its purpose. Silverstripe will automatically use it to store temporary files and data.

Conclusion:

By creating the silverstripe-cache folder within the root of your Silverstripe project, you're taking a proactive step to optimise performance, enhance maintenance, and prevent potential server issues. It's a simple yet effective practice that ensures your Silverstripe website runs smoothly and efficiently.