<?php
namespace Claromentis\Core\Cache;

$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] ?: array()) + array("_72f158add48659f6" . "7a9df82de6646312" => base64_decode("c3lzdGVtX2Nh" . "Y2hlX2NsZWFy" . "ZWQ="), "_927fa79e65e272737620f5a863f058a" . "e" => base64_decode("L2NhY2hlX2" . "NsZWFyZWQu" . "ZGF0"), "_8a36a84baeff" . "c0085672f9bf9" . "c064f67" => base64_decode("ZmlsZV9wdXRfY29u" . "dGVudHM="), "_19d1237a619f7b35ad6dbebf02" . "5f17c8" => base64_decode("c3Ry" . "Y21w"), "_644b798b" . "19dd133ec" . "9211fb916" . "df032b" => base64_decode("ZmlsZV9nZXRfY29udGVudHM" . "="), "_ca831b25ce7fffea9cf441f7" . "62c7d154" => base64_decode("Zmls" . "ZV9l" . "eGlz" . "dHM="), "_2d885755f5913d" . "eb2b5a483bd6761" . "1d1" => base64_decode("Y2ZnX2xvY2FsX2Rhd" . "GFfZGly"), "_5e9a99dc0dd49b90" . "7abf1b35e96965f8" => base64_decode("dH" . "Jp" . "bQ" . "=="));
use Claromentis\Core\Config\Config;
use Claromentis\Core\DAL\Interfaces\DbInterface;
use DBVar;
class CacheTimeCheck
{
    
    
    
    
    private $cache_cleared_file;
    
    
    
    
    private $cache_clearer;
    public function __construct(Config $config, CacheClearer $_2f905e47e14e38521e4b5cdebdd7a108)
    {
        $this->cache_cleared_file = $config->get($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_2d885755f5913deb2b5a483bd" . "67611d1"]) . $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_927fa79e65e272737620f5a" . "863f058ae"];
        $this->cache_clearer = $_2f905e47e14e38521e4b5cdebdd7a108;
    }
    public function ClearLocalCacheIfNeeded()
    {
        $_d531d220dbc6dcb35b78aff26b7f0278 = true;
        $_0a9dc3339bf8c0f28851462350e00fb4 = (string) DBVar::Get($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_72f158add" . "48659f67a9" . "df82de6646" . "312"], false);
        if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_ca831b25ce7fffea9cf441f762c" . "7d154"]($this->cache_cleared_file)) {
            $_52da7741c64702dba0065a6ffc0b23da = (string) $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_5e9a99dc0dd49b" . "907abf1b35e9696" . "5f8"]($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_644b798" . "b19dd133" . "ec9211fb" . "916df032" . "b"]($this->cache_cleared_file));
            if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_19d1237a619" . "f7b35ad6dbeb" . "f025f17c8"]($_52da7741c64702dba0065a6ffc0b23da, $_0a9dc3339bf8c0f28851462350e00fb4) >= 0) {
                $_d531d220dbc6dcb35b78aff26b7f0278 = false;
            }
        }
        if ($_d531d220dbc6dcb35b78aff26b7f0278) {
            $this->ClearLocalCache();
        }
    }
    public function ClearLocalCache()
    {
        $this->cache_clearer->Reset();
        $this->UpdateLocalTimestamp();
    }
    public function ClearAllCache()
    {
        $this->cache_clearer->Reset();
        $this->cache_clearer->ResetShared();
        $this->UpdateLocalTimestamp();
    }
    protected function UpdateLocalTimestamp()
    {
        $_d230962d9a57dc6ba2b774d9ba3bb81e = new \Date();
        $_d230962d9a57dc6ba2b774d9ba3bb81e = $_d230962d9a57dc6ba2b774d9ba3bb81e->getDate(DATE_FORMAT_TIMESTAMP);
        $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_8a36a84baeff" . "c0085672f9bf9" . "c064f67"]($this->cache_cleared_file, $_d230962d9a57dc6ba2b774d9ba3bb81e);
    }
    public function UpdateSharedTimestamp(DbInterface $db)
    {
        $_d230962d9a57dc6ba2b774d9ba3bb81e = new \Date();
        $_d230962d9a57dc6ba2b774d9ba3bb81e = $_d230962d9a57dc6ba2b774d9ba3bb81e->getDate(DATE_FORMAT_TIMESTAMP);
        $db->DisableTokenCheck();
        DBVar::Set($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_72f158add48659f67a9d" . "f82de6646312"], $_d230962d9a57dc6ba2b774d9ba3bb81e);
        $db->EnableTokenCheck();
    }
}