<?php
namespace Claromentis\Core\Cache;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] ?: array()) + array("_644b798b19dd133ec92" . "11fb916df032b" => base64_decode("ZmlsZV9nZXRfY29udGVudH" . "M="), "_19d1237" . "a619f7b3" . "5ad6dbeb" . "f025f17c" . "8" => base64_decode("c3RyY" . "21w"), "_2d885755f5913deb2b5a483bd67" . "611d1" => base64_decode("Y2ZnX2x" . "vY2FsX2" . "RhdGFfZ" . "Gly"), "_72f158add48659" . "f67a9df82de6646" . "312" => base64_decode("c3lzdGVtX2NhY2hlX2NsZWF" . "yZWQ="), "_ca831b25ce7fffea9cf441f" . "762c7d154" => base64_decode("ZmlsZV9leGl" . "zdHM="), "_927fa79e65e" . "272737620f5a" . "863f058ae" => base64_decode("L2NhY2hlX2NsZ" . "WFyZWQuZGF0"), "_8a36a84baeffc00" . "85672f9bf9c064f6" . "7" => base64_decode("ZmlsZV9wd" . "XRfY29udG" . "VudHM="), "_5e9a99dc0dd49b9" . "07abf1b35e96965f" . "8" => base64_decode("dHJ" . "pbQ" . "=="));
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["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_2d885755f5913deb2b" . "5a483bd67611d1"]) . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_927fa79e65e2727" . "37620f5a863f058a" . "e"];
        $this->cache_clearer = $_2f905e47e14e38521e4b5cdebdd7a108;
    }
    public function ClearLocalCacheIfNeeded()
    {
        $_d531d220dbc6dcb35b78aff26b7f0278 = true;
        $_0a9dc3339bf8c0f28851462350e00fb4 = (string) DBVar::Get($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_72f158add48659f67a9df82de664" . "6312"], false);
        if ($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_ca831b25ce7ff" . "fea9cf441f762c" . "7d154"]($this->cache_cleared_file)) {
            $_52da7741c64702dba0065a6ffc0b23da = (string) $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_5e9a99d" . "c0dd49b9" . "07abf1b3" . "5e96965f" . "8"]($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_644b798b19dd133ec9211fb916df0" . "32b"]($this->cache_cleared_file));
            if ($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_19d1237a619f7b3" . "5ad6dbebf025f17c" . "8"]($_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["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_8a36a84baeffc00856" . "72f9bf9c064f67"]($this->cache_cleared_file, $_d230962d9a57dc6ba2b774d9ba3bb81e);
    }
    public function UpdateSharedTimestamp(DbInterface $db)
    {
        $_d230962d9a57dc6ba2b774d9ba3bb81e = new \Date();
        $_d230962d9a57dc6ba2b774d9ba3bb81e = $_d230962d9a57dc6ba2b774d9ba3bb81e->getDate(DATE_FORMAT_TIMESTAMP);
        $db->DisableTokenCheck();
        DBVar::Set($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_72f158ad" . "d48659f67" . "a9df82de6" . "646312"], $_d230962d9a57dc6ba2b774d9ba3bb81e);
        $db->EnableTokenCheck();
    }
}