PHP code example of vsavritsky / bitrix-rest-api-cache

1. Go to this page and download the library: Download vsavritsky/bitrix-rest-api-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vsavritsky / bitrix-rest-api-cache example snippets

 
$cache = new PhpCache($this->getRequest());
$cacheResult = $cache->init();
if (!$cacheResult) {
    // кешируемый вызов
    // $result = ['test' => 1];
    if ($result) {
        $cache->addTag('test');
        $cacheResult = new TestResponse();
        $cache->cache($result);
    }
}