DmitryDulepov\Realurl\Cache\DatabaseCache::putUrlToCache PHP Method

putUrlToCache() public method

Sets the entry to cache.
public putUrlToCache ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry ) : void
$cacheEntry DmitryDulepov\Realurl\Cache\UrlCacheEntry
return void
    public function putUrlToCache(UrlCacheEntry $cacheEntry)
    {
        $data = array('expire' => $cacheEntry->getExpiration(), 'original_url' => $cacheEntry->getOriginalUrl(), 'page_id' => $cacheEntry->getPageId(), 'request_variables' => json_encode($cacheEntry->getRequestVariables()), 'rootpage_id' => $cacheEntry->getRootPageId(), 'speaking_url' => $cacheEntry->getSpeakingUrl());
        if ($cacheEntry->getCacheId()) {
            $this->databaseConnection->exec_UPDATEquery('tx_realurl_urldata', 'uid=' . $this->databaseConnection->fullQuoteStr($cacheEntry->getCacheId(), 'tx_realurl_urldata'), $data);
        } else {
            $this->databaseConnection->sql_query('START TRANSACTION');
            if ($this->limitTableRecords('tx_realurl_urldata')) {
                $this->databaseConnection->sql_query('DELETE FROM tx_realurl_uniqalias_cache_map WHERE url_cache_id NOT IN (SELECT uid FROM tx_realurl_urldata)');
            }
            $data['crdate'] = time();
            $this->databaseConnection->exec_INSERTquery('tx_realurl_urldata', $data);
            $cacheEntry->setCacheId($this->databaseConnection->sql_insert_id());
            $this->databaseConnection->sql_query('COMMIT');
        }
    }