You are currently viewing the article on an older Shopware version!

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 caches (4)
    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
  • Clear and warm up caches (5)
    First a new cache is created. The old cache is removed after the new cache has been created.

  • 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

    Use the dropdown menu (7) to select all indices that should not be updated when updating indices. Below, you´ll find a list of all entries and their descriptions. All entries with a "-" is a subprocess to the index above. If a main index is checked all subindexes will be checked.
     

    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 searchindex of the customers
    - customer.many-to-many-id-fieldSupporting task to join the tables
    landing_page.indexerCreates an index of all landingpages
    - landing_page.many-to-many-id-fieldSupporting task to join the tables
    - landing_page.seo-urlCreates an index of the seo-urls of the landingpages
    media.indexerCreates an index of the mediafiles
    - 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 methodes
    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 a 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-reciepients
  • Elasticsearch Indexes (8)
    All indexes are updated asynchronously. The option is available only with the Advanced Search extension installed.

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 http:cache:warm:up

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?