ogdev / bitrix-rest-api-cache
Библиотека для кеша приложения основенного на апи
Installs: 166
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
pkg:composer/ogdev/bitrix-rest-api-cache
Requires
- php: >=7.4
- predis/predis: ^1.1
- slim/psr7: dev-main
This package is not auto-updated.
Last update: 2025-10-09 14:07:59 UTC
README
Для подключения кеша редиса к битриксу нужно:
- Установить зависимость composer require ogdev/bitrix-rest-api-cache
- В файл bitrix/php_interface/dbconn.php подключить автолоадер require($_SERVER['DOCUMENT_ROOT'] . "/local/php_interface/vendor/autoload.php");
- Добавить настройки подключения редиса в файл bitrix/.settings_extra.php (пример в папке examples)
- Вызов кеша в контроллере
$cache = new PhpCache($this->getRequest());
$cacheResult = $cache->init();
if (!$cacheResult) {
// кешируемый вызов
// $result = ['test' => 1];
if ($result) {
$cache->addTag('test');
$cacheResult = new TestResponse();
$cache->cache($result);
}
}