Below, we shed light upon how to manage caches and indexes in Shopware 6. By default, the system lets you leverage both functionalities if you run a self-hosted website. If you use a cloud storefront, the corresponding admin section is absent. So, what are the Shopware 6 caches? Where to find indexes in your admin? How to manage both? You will find answers to these and other questions below.
‘
Note that we provide Shopware integration with external platforms. Contact our support for further information or try our Improved Import & Export Extension for Shopware.
Table of contents
Shopware 6 Caches & Indexes
A cache in Shopware 6 is a software component that stores data with the following purpose – to speed up future requests. Usually, the data stored in a cache might be the result of earlier interaction with your e-commerce website or a copy of data stored somewhere else.
As for a Shopware 6 index, it is a list of data saved in a plain text format. Usually, indexes represent a group of files or database entries that can be quickly scanned by a search algorithm. Consequently, searching and sorting operations are dramatically enhanced, achieving new performance.
How to find Shopware 6 cache and indexes
You can find the Caches & Indexes module in your Shopware 6 administration under Settings -> System.
How to manage cache and indexes in Shopware 6
The system provides you with the ability to empty and warm up your cache.
At the same time, you can view several other configurations under the Caches & Indexes screen.
Below, you can see the corresponding admin section:
It informs you whether your e-commerce website is in production mode. This state is indicated as Production under Environment. Besides, Shopware 6 notifies whether the HTTP cache is enabled. The cache adapter currently used in the system also displays here.
As for the environment mode and HTTP cache, you can switch them manually. Find the .env file in the Shopware main directory and apply the necessary changes there.
For instance, you can disable the HTTP cache in Shopware 6 as follows:
- Open the .env file in the Shopware main directory;
- Find the following line:
SHOPWARE_HTTP_CACHE_ENABLED=1
- Type =0 instead of =1 to deactivate the HTTP cache in Shopware 6.
Also, it is necessary to mention that you have different functions for the cache and index management in the lower part of the module. Let’s describe each one.
How to clear caches in Shopware 6
Shopware 6 lets you clear caches with the help of a single button click. Follow these steps to do that:
- Go to the Caches & Indexes module in your Shopware 6 administration under Settings -> System;
- Find the Clear caches button.
- Click it – this action clears caches synchronously for all used adapters.
Use this approach to empty the caches without having to reheat them directly afterward.
Alternatively, Shopware 6 lets you achieve the same effect in the console. Use the following command to clear all caches in Shopware 6:
php bin/console cache:clear |
How to clear and warm up caches in Shopware 6
You can clear and warm up caches in Shopware 6 as follows:
- Go to the Caches & Indexes module in your Shopware 6 administration under Settings -> System;
- Find the Clear & warmup caches button.
- Click it – this action clears caches asynchronously, creating new caches afterward.
How to update indexes in Shopware 6
You can update indexes in Shopware 6 as follows:
- Go to the Caches & Indexes module in your Shopware 6 administration under Settings -> System;
- Find the Update Indexes button.
- Click it – this action updates indexes asynchronously.
You can view the progress of how Shopware 6 updates such indexes as the category and product indexes and the SEO URLs in the Notification Center.
Alternatively, you can use the following command to update Shopware 6 indexes in the console:
php bin/console dal:refresh:index |
How to empty the cache in Shopware 6 automatically
Since Shopware 6 doesn’t empty the cache automatically, it leads to performance degradation and consumption of additional server space. Therefore, you need to empty the cache of the store periodically. You can do that manually with the help of the following command in the admin console:
rm –rf SHOPWARE–ROOT–DIRECTORY/var/cache/* |
However, you can automate this process with the help of cronjob. The official Shopware 6 documentation recommends executing it once a day. Since the store traffic is usually the lowest during the night time, execute the command during this period.
You can find out how to set up a regular cronjob on your server from your provider or in the corresponding documentation.
How to Import Data from External Platforms to Shopware 6
In some cases, you need to import data to Shopware 6 to get something that the system can cache. Our team lets you simplify and automate various processes associated with data transfers to Shopware 6. Contact our support for more details and try our Improved Import & Export Extension for Shopware. You can use it to import any entity to Shopware 6 from any external platform. Please, consult our specialists before using our module.
‘