Skip to content

Commit

Permalink
#66 Поправил работу с кэш. Теперь только с Redis
Browse files Browse the repository at this point in the history
  • Loading branch information
apor committed Nov 21, 2023
1 parent e6594e1 commit db396c1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Lib/Bitrix24Integration.php
Expand Up @@ -12,11 +12,8 @@
use MikoPBX\Common\Models\CallQueues;
use MikoPBX\Common\Models\IncomingRoutingTable;
use MikoPBX\Common\Models\Extensions;
use MikoPBX\Core\System\Processes;
use MikoPBX\Core\Workers\Cron\WorkerSafeScriptsCore;
use MikoPBX\Modules\Logger;
use MikoPBX\Modules\PbxExtensionBase;
use MikoPBX\Modules\PbxExtensionUtils;
use MikoPBX\PBXCoreREST\Lib\PBXApiResult;
use Modules\ModuleBitrix24Integration\Models\{ModuleBitrix24ExternalLines,
ModuleBitrix24Integration,
Expand All @@ -25,7 +22,7 @@
};
use MikoPBX\Core\System\Util;
use Modules\ModuleBitrix24Integration\bin\WorkerBitrix24IntegrationHTTP;

use \Modules\ModuleBitrix24Integration\Lib\CacheManager;

class Bitrix24Integration extends PbxExtensionBase
{
Expand Down Expand Up @@ -536,7 +533,12 @@ public function getAccessToken(): string
*/
public function getCache($cacheKey)
{
return $this->di->getManagedCache()->get($cacheKey);
$value = null;
$data = CacheManager::getCacheData($cacheKey);
if(!empty($data) && isset($data[0])){
$value = $data[0];
}
return $value;
}

/**
Expand All @@ -552,8 +554,7 @@ public function getCache($cacheKey)
*/
public function saveCache(string $cacheKey, $resData, int $ttl = 3600): void
{
$managedCache = $this->di->getManagedCache();
$managedCache->set($cacheKey, $resData, $ttl);
CacheManager::setCacheData($cacheKey, [$resData], $ttl);
}

/**
Expand Down

0 comments on commit db396c1

Please sign in to comment.