Overview
The cache is a buffer for database queries, template files and snippets and is used to boost performance. Cached data does not require further query in the database.
The central Cache/Performance module can be found under Configuration in the backend. This is divided into three areas:
- Start - Simplifies the cache handling of your shopware installation.
- Cache - Overview of the cache directories, their sizes and their rights (full write and read access required). Areas can be cleared individually.
- Settings - Definition of the cache strategies of individual areas, updated manually. Individual areas can be activated/deactivated here.
Cache directory
Shopware 5 introduced a simplified means of cache management. The system now creates a separate directory every time a revision is made (including staging environments). This means with an update, Shopware automatically creates and uses the new folder, while the previous folder is archived.
Start
The Start tab contains the following modes to simplify the cache handling in shopware.
- Productive mode - The production mode should be activated if the template will no longer be changed and the shop is running in a live environment. Since the HTTP cache is automatically activated, changes (i.e. to the template or prices) will not appear until the cache has been cleared. This makes for better performance in your online shop.
- Development mode - This mode is for setting up and configuring Shopware, as most changes will immediately be visible in the frontend without a need to clear the cache first. Since the HTTP cache is not activated, the shop will run a bit slower than when in the production mode.
Cache
- Shopware configuration - Settings and snippets
- Proxies and metadata - Proxy objects
- Smarty template cache - Frontend templates
- Cache search function - Search results and index
- Theme cache - Clears the compiled theme caches. After this, a popup will appear to rebuild the theme cache and clear the HTTP cache
- Http proxy cache - Frontend HTTP cache (clears the cache directories)
- Index SEO URLs - Create new SEO URLs
Settings
Here the SSI optimization methods are displayed.
- APCu activated: The APCu can activated
- Zend OPcache activated: The Zen OPcache can be activated
- PHP Version: Use a PHP version >= 5.4 (with Shopware 5, the hook will be set only if you are running the latest version of PHP)
These are only suggestions for optimization. Omitting optional settings has no effect on Shopware's functionality.
HTTP cache
The HTTP cache comes as a default feature of Shopware. In order for it to be used, it must first be activated in the backend.
Cache warmer
The http-cache can be completely warmed up using the Cache Warmer. In simple terms, this means that all pages of the shop are called once and loaded into the cache. If this did not happen using the Cache Warmer, the cache would build up when a user visits the shop, resulting in a considerably longer load time. To save the user this waiting time, you can warm up the cache yourself.
If the HTTP cache is active, you can warm it up using the blue "Warm up cache" button. Click on the button and select the desired shop in the popup that opens and click on "Start process". The cache will then be warmed up.
Batch size: This is the number of calls processed by the server.
Concurrency: Select here how many processes should work in parallel on the cache warmup. Depending on the server, more or less parallel processes can be useful, just test here which setting delivers the fastest results.
Advanced settings: Here you can define which pages of your shop should be warmed up. Click "Save as default" to save the current configuration for future use.
Activating and configuring the HTTP cache
In the backend, go to Configuration > Cache/performance and switch to the Settings tab. In the directory labeled General, find the subdirectory HTTP cache.
By clicking the checkbox next to Activate HTTP cache, the plugin will handle all caching from this point forward.
Additional configuration options like the cache invalidation, alternate proy URLs and the admin view can also be found here.
- Automatic cache invalidation clears the cache of the product detail page whenever a product is modified.
- Alternate proxy URL allows you to select a desired proxy if you work, for example, with Varnish.
- Admin view hides the option that product detail pages are no longer cached, but opened from the backend.
Defining cache times
- Here you can set the cache time of the shop itself. This defines the number of seconds that a controller is held in the cache. Once the set time has elapsed, the cache will be regenerated the next time the page is called.
- The same applies for controller tags which have not been cached. Here individual areas of the page are not caches, such as a screenshot of the price on the product detail page and in the listing.
- When defining the controller (- actions) cache times you should only enter a controller where it makes sense to cache it, e.g. the listing. It makes sense to use controllers where normally no changes are made over a longer period of time and which can then be loaded faster by caching.
- With non-cached controller tags you control when a cached controller (action) defined above should no longer be cached.Here you can work with different tags (slt = customer has the "stay logged in" status, "checkout" => the customer has products in the checkout, etc.) You can find the tags within a session, e.g. in the default the start page is flagged with the tag "price". The following tags are available:
- slt = customer is logged in
- checkout = customer has added item to shopping cart
- Compare = customer has an item in comparison
For further information, see our developers documentation about HTTP cache.
Please note that the cache function isn’t compatible with scrolling functions on the product detail page. This applies only if you change the sorting in the category view (i.e. from sorting by price to date of creation). The sorting is ignored if you open a product in the overview then click the “Next” button.
Theme cache
Here you can rebuild the theme cache. After rebuilding the theme cache, the HTTP cache will be cleared.
SEO
Here you can define the cache strategies for SEO friendly URLs. The default setting is Live. This setting determines how URLs are dynamically updated and created. The process here is identical to previous versions of Shopware. There are Manual and Cronjob strategies for this. The automatic generation of SEO URLs is deactivated with this setting. URLs are only updated by cronjob (i.e. evenings) or manually. Manual updating is performed by clicking the button in this window. The URLs can then be handled for the desired shop completely via batch processing.
Search
Here the update strategies of the search indexes can be defined. This setting determines how often the search index is recreated (by calling the search in the frontend). The process here is identical to previous versions of Shopware. There are Manual and Cronjob strategies for this. The automatic generation of SEO URLs is deactivated with this setting. The search index is only updated by cronjob (i.e. evenings) or manually. Manual updating is performed by clicking the button in this window.
Categories
- Rebuild category tree: This is a repair functionality, that is not meant to be used ragulary and which reorders and thus repairs categories, their connections and the product assignment.
- Move categories into batch mode: Suitable for larger operations and structures.
- Default sort order for listing: Here you can confiure the default sort for the listing.
- Items per page: Define the number of products that appear per product listing page.
Filters
- Display filter button: Product listing will be reloaded using a button.
- Live product reloading: When a product list get filtered, it will get reloaded immediatly.
- Live product and filter reloading: When a product list get filtered, it will get reloaded immediatly. Filters, which are not combinable will be deactivated.
Sitemap
Here you can define how and when the sitemap is to be generated. You can use the cache time to define that the sitemap is not regenerated too frequently (e.g. with every call). The time is specified in seconds.
Various
- Deactivate Shopware statistics: When selected, customer/visitor data will not be collected in the frontend.
- Display previously viewed items: Default setting = active
- Number of items displayed: Default setting = 5
- Disable item navigation on item detail pages: Default setting = not active
Top seller
- Build new index: All data in the shop is recalculated and recached.
- Display top seller in shop: Top sellers can be deactivated here.
- Top seller valid for [n] days: Set the length of time for which top sellers should be displayed. Value must be >0
- Include orders from the past [n] days: Shopware calculates top sellers based on orders from the last [n] days.
- Refresh strategy: Determine whether updates should be performed live, via cronjob or manually.
- Take pseudo sales into account: If this is active, pseudo sales will have an influence on determining top sellers.
Referral marketing
- Build index for 'Customers also bought': These are recalculated with every new item purchase. Recalculation can be memory intensive.
- Customers also bought: Activates the "Customers also bought" box on the product detail page.
- Rebuild 'Customers also viewed' index: This recalculates what other customers have already viewed in context. Recalculation can be memory intensive.
- Activate 'Customers also viewed': Here you have the option to deactivate the saving of data once an order is completed. This is helpful if you have many orders in a shop that take up several positions, as many combinations need to be reloaded.
- Display: The box "Customers also viewed" will be displayed on the product detail page.
- Generate new every [n] days: Defines the period after which the product is to be recalculated.
- Refresh strategy: Live (refreshes in a live environment), Via cronjob (refreshes via cronjob), Manually (refreshes via Build index)
Was this article helpful?