Skip to content

Instantly share code, notes, and snippets.

@kvalexandr
Created January 8, 2016 06:38
Show Gist options
  • Save kvalexandr/37ac258ea0393d738ecc to your computer and use it in GitHub Desktop.
Save kvalexandr/37ac258ea0393d738ecc to your computer and use it in GitHub Desktop.
<?php
$cacheId = 'uniqueCacheId';
$cacheTtl = '3600';
$cache = \Bitrix\Main\Application::getInstance()->getManagedCache();
if ($cache->read($cacheTtl, $cacheId)) {
$data = $cache->get($cacheId); // get our data
} else {
$data = '12345678';
$cache->set($cacheId, $data); // set our cache
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment