How to Manage Caches & Indexes in Shopware Store?
Caches and indexes are undoubtedly familiar to Shopware self-hosted shop owners. If you’re using Shopware Cloud, however, this section isn’t available.
So, in today’s post, we’ll show you how to manage caches and indexes in your Shopware store. Let’s get started!
Table of contents
- Overview of Shopware 6 Caches and Indexes
- How to Manage Caches and Indexes in Shopware Store?
- Final Words
Overview of Shopware 6 Caches and Indexes
In Shopware 6, a cache is a software component that saves data for the aim of speeding up subsequent requests. Data in a cache is usually the product of previous interactions with your e-commerce website or a duplicate of data kept elsewhere.
A Shopware 6 index is a plain text file containing a list of data. Indexes are often a collection of files or database entries that can be examined rapidly by a search algorithm. As a result, searching and sorting procedures can be significantly improved, attaining new levels of performance.
The Caches & Indexes module can be found under Settings > System in your Shopware 6 administration. This module, however, requires that your store be self-hosted.
How to Manage Caches and Indexes in Shopware Store?
Shopware 6 administration allows you to empty and warm up your caches. Caches & Indexes is a module that notifies you if your e-commerce website is in production mode. Under Environment, this state is defined as Production. Shopware 6 also informs you whether the HTTP cache is enabled. The system’s current cache adapter is also displayed here.
You can manually change the Environment mode and the HTTP cache by making the necessary adjustments to the .env file in the Shopware main directory.
For example, you can disable the HTTP cache in Shopware 6 by following these simple steps:
Step 1: Go to the Shopware main directory and open the .env file.
Step 2: Look for the following sentence:
Step 3: Type =0 instead of =1 to disable the HTTP cache in Shopware 6.
It’s also worth noting that the lower part of the module has many other functions for cache and index management. Let’s have a look at them!
How to clear caches in Shopware 6?
In Shopware 6, you can clear caches with a simple button click. To do so, follow these steps:
Step 1: Find the Caches & Indexes module by going to Settings > System in your Shopware 6 administration.
Step 2: Locate the button Clear caches.
Step 3: You need to click on the button Clear caches. This will allow you to clear caches for all adapters in a synchronous manner.
Shopware 6 also allows you to accomplish the same task in the console. To clear all caches in Shopware 6, use the following command:
php bin/console cache:clear
How to clear and warm up caches in Shopware 6?
In Shopware 6, you can manage caches by cleaning and warming up them. Follow the below steps to do that:
Step 1: Navigate to the Caches & Indexes module under Settings > System in your Shopware 6 administration.
Step 2: Locate the button Clear and warmup caches.
Step 3: Click on the button Clear and warmup caches. New cache entries will be produced asynchronously once the cache has been cleaned.
How to update indexes in Shopware 6?
To manage indexes in Shopware 6, you can update them by following the below steps:
Step 1: Go to the Caches & Indexes module under Settings > System in your Shopware 6 administration.
Step 2: Identify the Update Indexes button.
Step 3: Click on the button Update Indexes. This will allow indexes to be updated asynchronously.
In the Notification Center, you can see how Shopware 6 updates indexes, including the category and product indexes, as well as SEO URLs.
Additionally, you can also update Shopware 6 indexes in the console with the following command:
php bin/console dal:refresh:index
How to empty the cache in Shopware 6 automatically?
Because Shopware 6 does not empty the cache automatically, speed suffers and extra server space is consumed. As a result, you must empty the store’s cache on a regular basis. You can do it manually in the admin console by using the following command:
rm -rf SHOPWARE-ROOT-DIRECTORY/var/cache/*
You can, however, use cronjob to automate this process. It is recommended that you run it once a day, according to the official Shopware 6 instructions. Because shop traffic is normally at its lowest at night, you should run the command at this time.
Your provider or the appropriate documentation can tell you how to set up a regular cron job on your server.
We hope that after reading our comprehensive instructions, you will have gained some useful knowledge. Managing caches and indexes in your self-hosted Shopware shop is actually rather simple and only takes a few clicks, so we’re sure that you’ll be able to accomplish it successfully on your own.
In case you have any questions, feel free to reach out to us via the comments section below. We’re willing to answer all your questions and help you out. Thank you for reading and we’ll see you in the next post.
not your workload
Simple, powerful tools to grow your business. Easy to use, quick to master and all at an affordable price.Get Started