Views: 2399 (Data available since 06.02.2017)
Last Modified: 10.10.2012

Dynamic components should use caching to accelerate the processing of client queries and decrease the server load. Generally, only visitor-independent information can be cached. For example, the site index page is usually the same for all visitors. Hence, the news data need not be fetched from database every time. The cache lifetime may vary depending on the frequency of updates. However, sometimes it is reasonable to cache information that pertains to a visitor.

Components 2.0 have built-in cache support. The components that support caching show cache control parameters in the component property sheet:

The following three cache modes exist:

  • Autocache
  • (Always) Cache
  • Don't cache

If the option Cache if the filter is active is active, the data fetched to a visitor as a result of a filtered search request, will be cached. This will use the specified cache mode and lifetime.

Autocache

The autocache mode can be controlled on the Settings -> System settings -> Cache settings page:

You can configure the cache mode for components that support caching irrespective of this setting.

Note! The autocache mode use implies that the information obtained and rendered by components is updated according to the cache preferences of individual components.

You can control caching for components whose cache setting is Auto using just this button in Settings -> System settings -> Cache settings.

(Always) Cache

This mode specifies that the component output is always cached irrespective of the system-wide cache mode as frequently as selected in the component cache settings.

Don't cache

It this option is selected, no caching takes place, irrespective of other cache settings.

Note! If the cache lifetime is set to zero, caching never occurs.

Any of the following actions update cached page objects:

  1. Opening a page and updating it by clicking the cache clear button:

  2. If a component supports caching, the command Clear component's cache is available irrespective of the selected cache mode; this command wipes the cache and forces the page to refresh its dynamic data:

  3. Switching a component to Do not cache mode in the component settings:



Courses developed by «Bitrix», Inc.