Views: 11357
Last Modified: 28.06.2024

One of the types of caching in Bitrix Framework is component caching.

Components must use caching in order to process the client’s request faster and to reduce the server load. As a rule, the information that is not dependent on a specific visitor must be cached. For example, the list of website news is the same for all visitors. That is why it makes no sense to select the data from the database each time.

All dynamic components that are used in order to create web pages have an embedded support of cache control. In order to use the technique, it is sufficient to activate auto cache by clicking a button on the administrative panel. This feature comes in handy at the developing stage when auto cache can be deactivated to make the work easier, and activated again before delivery of the project. In this case, all of the components with auto cache mode activated in their settings will create caches and will entirely switch to a work mode that does not involve database queries.

Attention! When using the Autocache mode (Components cache), the information retrieved by the components is updated according to the parameters of separate components.

Auto cache control is located on the tab Component caching (Control Panel > Settings > System settings > Cache Settings).

Note: When component auto cache mode is activated, the components with the caching setting Auto + Managed will be switched to a work mode with caching.

In order to update the contents of cached objects on a page, you can:

  1. Go to the required page and update its contents using the button Refresh Cache on the control panel.
  2. In Edit Mode use the flush cache buttons on panels of specific components.
  3. Use automatic cache reset upon the expiry of caching time; for this, select the caching mode Cache or Auto + Managed in the component settings.
  4. Use automatic cache reset when data are changed; for this, select the caching mode Auto + Managed in the component settings.
  5. Go to the settings of the selected components and switch them to the work mode without caching.

Note: For additional information about component caching, please refer to the lesson Caching in Own Components.




Courses developed by Bitrix24