Configuring 1C-Bitrix Managed Cache

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1177
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Configuring Managed Cache in 1C-Bitrix

Managed cache in Bitrix is a tagged caching mechanism where each cached object is labelled with tags and invalidation happens by tag rather than by TTL. This solves the main problem with standard file cache: when one record is updated in an infoblock of 10,000 elements, the entire infoblock cache is flushed — all components using its data start running cold.

How Managed Cache Works

The \Bitrix\Main\Data\ManagedCache class operates on top of a storage backend — by default memcached or Redis (configured in /bitrix/.settings.php). Tags are stored separately from data: each tag is a version counter. When a tag is invalidated, the counter is incremented, and all records with an outdated tag version are treated as invalid.

Example usage in a component:

$managedCache = Application::getInstance()->getManagedCache();
$cacheTag = 'iblock_id_' . $ibId;

if ($managedCache->read(3600, 'my_cache_key', $cacheTag)) {
    $result = $managedCache->get('my_cache_key');
} else {
    $result = /* expensive query */;
    $managedCache->set('my_cache_key', $result);
    $managedCache->registerTag($cacheTag);
}

When \Bitrix\Main\TaggedCache::clearByTag('iblock_id_5') is called, only data tagged with that tag is flushed — all other components continue serving from cache.

Configuring Redis as the Backend

For production, Redis is recommended — it is faster than memcached when working with tags and supports persistence. Configuration in /bitrix/.settings.php:

'cache' => [
    'value' => [
        'type' => [
            'class_name' => '\\Bitrix\\Main\\Data\\CacheEngineRedis',
            'extension' => 'redis',
        ],
        'sid' => 'mysite',
        'host' => '127.0.0.1',
        'port' => 6379,
        'serializer' => Redis::SERIALIZER_IGBINARY,
    ],
],

The serializer => IGBINARY parameter matters: it reduces the size of serialised PHP objects by 30–50% compared to the default serialize().

Case Study: Cache Invalidation with Frequent Updates

An online store with hourly 1C synchronisation: every hour prices and stock for 500–2,000 items are updated. With standard cache using the IBLOCK_N tag, the entire infoblock cache was flushed 24 times per day. After switching to managed cache with granular tags of the form iblock_element_ID, flushing happens only for changed elements. Pages of unchanged products continue to be served from cache.

What Needs to Be Configured

Correct managed cache setup includes: selecting and configuring the backend (Redis/memcached), verifying the Bitrix version (D7 API, main module version 20+), reviewing components for use of the outdated CBitrixComponent::getCache(), and migrating to ManagedCache where granular invalidation is required. Work takes 1–3 days depending on the number of components and whether Redis is already on the server.