Download the PHP package alex19pov31/bitrix-redis-cache without Composer
On this page you can find all versions of the php package alex19pov31/bitrix-redis-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download alex19pov31/bitrix-redis-cache
More information about alex19pov31/bitrix-redis-cache
Files in alex19pov31/bitrix-redis-cache
Download alex19pov31/bitrix-redis-cache
More information about alex19pov31/bitrix-redis-cache
Files in alex19pov31/bitrix-redis-cache
Vendor alex19pov31
Package bitrix-redis-cache
Short Description Bitrix redis cache engine
License MIT
Package bitrix-redis-cache
Short Description Bitrix redis cache engine
License MIT
Please rate this library. Is it a good library?
Informations about the package bitrix-redis-cache
Bitrix Redis cache
Кеширование данных посредством Redis.
Установка
Настройка
В файле /bitrix/.settings_extra.php (если его нет, то создать) прописываем настройки:
Подробней о параметрах подключения можно прочитать тут - https://github.com/nrk/predis/wiki/Connection-Parameters
Автолоадер надо подключать в /bitrix/dbconn.php.
Использование
Принудительное использование (без конфигурационного файла)
use Alex19pov31\BitrixRedisCache\RedisCacheEngine;
use Bitrix\Main\Data\Cache;
$cacheEngine = new RedisCacheEngine([
'scheme' => 'tcp',
'host' => '127.0.0.1',
'port' => 6379,
]);
$data = null;
$ttl = 3600; // кешируем на час
$key = "test_key"; // ключ кеша
$cache = new Cache($cacheEngine);
if ($cache->initCache($ttl, $key, 'redis')) {
$data = $cache->getVars();
// или если имело место быть кеширование вывода
$cache->output();
} elseif ($cache->startDataCache($ttl, $key, 'redis', [])) {
$data = 'Тестовые данные';
$cache->endDataCache($data);
}
All versions of bitrix-redis-cache with dependencies
PHP Build Version
Package Version
The package alex19pov31/bitrix-redis-cache contains the following files
Loading the files please wait ....