Caches & Indexes

Please note that this article is only for users of a self-hosted store. This is not relevant for users of a Shopware 6 SaaS environment.

In the module Caches & Indexes you are able to empty and warm up the cache. It also gives you an overview of some system configurations.

Configuration overview

In the overview you will get the information whether your shop is used in productive mode. This is indicated by the entry "Production" in the Environment (1).
You can also see here whether the HTTP cache is active (2) and which cache adapter (3) is used.

You can adjust the environment mode and HTTP cache in the .env file in the Shopware main directory.
For more information on how to customize the environment settings, click here.

SHOPWARE_HTTP_CACHE_ENABLED=1

activated. (=0) deactivates the cache.
 

Manage Caches & Indexes

In the lower part of the module, you have different functions for the cache and the indexes.

  • Clear data cache (4)
    You use the data cache to delete all non-essential store data that has nothing to do with the price calculation. These are, for example, changes in experience worlds. 

  • Clear cache (5)
    This can be used to empty the caches without having to reheat them directly afterwards.
    This is also available in the console.

    php bin/console cache:clear
  • Indexes (6)
    Updates the indexes such as the category and product indexes and the SEO URLs.
    In the console, this can be done using the command

    php bin/console dal:refresh:index

    You can use the two drop-down menus (7) to select all the indices that are to be updated.

    Use the drop-down menu indexers and/or updaters to skip to select the indices to be updated. With the first Method drop-down menu Method, you can select whether all selected indices should be updated (Only update selected) or all unselected indices (Update all, but skip selected).

    Below you will find a list of the indices that can be updated here. Entries with a “-” are sub-items of the index listed above. If the main index is selected, the sub-items are also selected.

    IndizesDescription
    category.indexerCreates an index for the categories
    - category.child-countCreates an index with a count of subcategories
    - category.treeCreates an index of the category tree (categories and their subcategories)
    - category.breadcrumbCreates an index of the category tree to use it in the breadcrumb bar
    - category.seo-urlCreates an index of the seo-urls of the categories
    customer.indexerCreates a search index of the customers
    - customer.many-to-many-id-fieldSupporting task to join the tables
    landing_page.indexerCreates an index of all landing pages
    - landing_page.many-to-many-id-fieldSupporting task to join the tables
    - landing_page.seo-urlCreates an index of the seo-urls of the landing pages
    media.indexerCreates an index of the media files
    - media_folder.indexerCreates an index of the media folders
    - media_folder.child-countCounts the subfolders within the media folder
    media_folder_configuration.indexerUpdates the configs of subfolders according the master media folder
    payment_method.indexerCreates an index of the payment methods
    product.indexerCreates an index of all products
    - product.inheritanceUpdates the connections between products and their variants.
    - product.stockIndexes the available stock of the products
    - product.variant-listingCreates an index of all variants in the products
    - product.child-countCounts the variants
    - product.many-to-many-id-fieldSupporting task to join the tables
    - product.category-denormalizerChecks for abandoned products in categories(dead links) and removes them.
    - product.cheapest-priceDetermines the cheapest price within the products
    - product.rating-averagetCreates an average of the rating points of the product reviews
    - product.streamCreates the product listings for the dynamic product groups
    - product.search-keywordDefines a list of all search-keywords of the products
    - product.seo-urlCreates a list of seo-urls of the products
    product_stream.indexerCreates an index of the dynamic product groups
    product_stream_mapping.indexerCreates an index of mapping between categories and dynamic product groups
    promotion.indexerCreates an index of the promotions
    - promotion.exclusionCreates an index of exclusions within the promotions (Do not combine with...)
    - promotion.redemptionUpdates the list of promotions used by customers 
    rule.indexerCreates an index of the Rules within the Rule Builder
    - rule.payloadCreates an index of conditions in the rules
    sales_channel.indexerCreates an index of all sales channels
    - sales_channel.many-to-manySupporting task to join the tables
    flow.indexerCreates an index of all flows in the Flow Builder
    newsletter_recipient.indexerCreates an index of newsletter-recipients

Empty cache automatically

In Shopware 6 Standard, the cache is not cleared automatically. In the long run, this can lead to the Shopware installation becoming larger and larger and requiring more and more space on the server.

To clear the cache of the shop manually, you can use the Shopware CLI. How to use the Shopware CLI you can also find here.
To clear your cache, you can use the following command in the Shopware CLI:

php bin/console cache:clear

On a live system, we recommend that after clearing a cache, you also warm it up again. You can warm up the cache with the following command:

php bin/console cache:warmup

So that these commands do not have to be executed manually at regular intervals, we recommend executing them via cronjob once a day. This should be executed when the traffic on the shop is at its lowest. This can then always be done at night, for example. How you can set up a regular cronjob on a Linux server, for example, can be found here.

If the cache can not be deleted via the Shopware CLI command, you can try to delete the cache folders manually with the following command:

rm -rf SHOPWARE-ROOT-FOLDER/var/cache/*

Why is it useful to empty/update it?

The cache in Shopware 6 stores data with the purpose of speeding up future requests. Basically, the data stored in a cache can be the result of a previous interaction with websites. A Shopware 6 index is a list of data stored in a simple text format. In most cases, indexes represent a group of files or database records that are quickly searched by a search algorithm. Consequently, search and sorting operations are greatly improved, resulting in new levels of performance.

Was this article helpful?