Persists any deferred cache items.

@author Benjamin Carl <opensource@clickalicious.de>

@return bool TRUE if all not-yet-saved items were successfully saved. FALSE otherwise.
762016
public function commit()
    {
        // Save deferred items
        $deferredItems = $this->getDeferredItems();

        foreach ($deferredItems as $deferredItem) {
            $this->save($deferredItem);
        }
    }
798580
private function saveData(): bool
    {
        if ($cacheTime = $this->getMeta()->getCache()) {
            return Cache::set(
                $this->key,
                $this->getData(),
                $cacheTime,
                ['system', 'data']
            );
        }
        return false;
    }
678610
protected function isSaved(): bool
    {
        return $this->filesystem->has($this->path)
            && $this->filesystem->getTimestamp($this->path) > $this->file->getUpdatedAt();
    }
781131
private function isCacheValid()
    {
        if (!$this->cacheFile->exists()) {
            return false;
        }

        $cachedConfigTimestamp = $this->cacheFile->getTimestamp();

        /** @var \Bolt\Filesystem\Filesystem $configFs */
        $configFs = $this->app['filesystem']->getFilesystem('config');

        $configFiles = [
            'config.yml',
            'config_local.yml',
            'contenttypes.yml',
            'extensions.yml',
            'menu.yml',
            'permissions.yml',
            'routing.yml',
            'taxonomy.yml',
        ];
        foreach ($configFiles as $configFile) {
            $timestamp = $configFs->has($configFile) ? $configFs->get($configFile)->getTimestamp() : 0;
            if ($timestamp > $cachedConfigTimestamp) {
                // The configuration file timestamp is *newer* than the cache file's … invalidate!
                $this->invalidateCache();

                return false;
            }
        }

        return true;
    }
633812
public function flushCache()
    {
        $finder = new Finder();

        foreach ($finder->files()->in($this->cacheDir)->name('*.php') as $file) {
            unlink($file->getRealpath());
        }

        return true;
    }
1051928
public function persist()
    {

        $blob = $this->serializer->serialize($this->_attributes, $this->serializeOptions);

        $result = (bool)$this->filesystem->write($this->url, $blob, $this->getOption('file_locking'));

        if (!$hashMethod = $this->getOption('checksum_method')) {
            return $result;
        }

        $checksum = $this->createChecksum($hashMethod, $blob);

        $savedBlob = $this->filesystem->read($this->url);

        $this->checkData($hashMethod, $savedBlob, $checksum);

        return $result;
    }
639009
public function persistData()
    {
        // we sort the array first, useful for doing ris match
        if (!empty($this->userAgentsWithDeviceID)) {
            ksort($this->userAgentsWithDeviceID);

            $this->persistenceProvider->save($this->getPrefix(), $this->userAgentsWithDeviceID);
            $this->persistenceProvider->save($this->getPrefix(self::PREFIX_OVERWRITTEN), $this->overwritten_devices);
            $this->persistenceProvider->save($this->getPrefix(self::PREFIX_UA_BUCKET), array_keys($this->userAgentsWithDeviceID));
        }
    }
664810
protected function refreshExpiredCacheForContext($context = null, $forceRefresh = false)
    {
        $key = $this->getKey($context);
        if ($forceRefresh || $this->needRefresh($key)) {
            $this->logger->debug("Refreshing cache for $key ...");
            $this->cacheStorage->setItem($this->statusKeyFor($key), static::PENDING);
            $this->cacheStorage->setItem($key, serialize($this->getDataFromRealService($context)));
            $this->cacheStorage->setItem($this->statusKeyFor($key), static::COMPLETED);
            $this->cacheStorage->setItem($this->refreshedAtKeyFor($key), serialize($this->getDateTimeFactory()->now()));
            $this->logger->debug("Cache for $key has been refreshed !");
            return true;
        }
        return false;
    }
844802
public function isCached(CacheItemInterface $item = null)
    {
        if (!$item) {
            $key = $this->getCurrentKey();
            $item = $this->getItemStorage()->get($key);
        }

        return $item ? true : false;
    }
1318173
protected function afterSave()
	{
	    if($this->hasEventHandler('onAfterSave'))
	        $this->onAfterSave(new CEvent($this));

	    // Store new config values in cache
	    foreach($this->attributes as $key=>$value)
	    	Yii::app()->cache->set('settings_'.$key, $value);

	    return true;
	}
1114091
public function flush()
    {
        $this->initializeOnDemand();

        if ($this->cacheMapper->flush()) {
            // Reset the current state as well
            $this->cache = array();
            return true;
        } else {
            return false;
        }
    }
324528
public function flush()
    {
        $i = 0;
        $count = $this->count();

        while ($i < $count) {
            if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
                return false;
            }

            $i++;
        }

        return true;
    }
1145774
public function commit()
    {
        foreach ($this->defferedItems as $item) {
            $this->save($item);
        }

        $this->defferedItems = [];
        return true;
    }
1046622
private function isCacheUpToDate()
    {
        if (!file_exists($this->cachedFile)) {
            return false;
        }

        $cacheTime  = filemtime($this->cachedFile);
        $configTime = max(filemtime($this->configPath), filemtime($this->envFile));

        return $cacheTime == $configTime;
    }
998632
public function invalidateCache(): bool
    {
        if ($this->cache !== null) {
            $this->cache->delete($this->cacheKey);
            $this->items = null;
        }

        return true;
    }
1138076
public function commit()
    {
        list($old, $new) = $this->generateRollback();
        $updates = $this->generateUpdates();
        $updates = $this->combineUpdates($updates);
        usort($updates, array($this, 'sortUpdates'));

        foreach ($updates as $update) {
            // apply update to cache & receive a simple bool to indicate
            // success (true) or failure (false)
            $success = call_user_func_array($update[1], $update[2]);
            if ($success === false) {
                $this->rollback($old, $new);

                return false;
            }
        }

        $this->clear();

        return true;
    }
334812
private function _isCached() 
    {
        $filters = false;

        if ($this->cacheSettings) {
        
            if ($this->cache) {
                $filters = $this->cache->getCache();
            }
        }

        return $filters;
    }