BxDolCacheFile::setData PHP Méthode

setData() public méthode

Save all data in cache file.
public setData ( string $sKey, mixed $mixedData, integer $iTTL = false ) : boolean
$sKey string - file name
$mixedData mixed - the data to be cached in the file
$iTTL integer - time to live
Résultat boolean result of operation.
    function setData($sKey, $mixedData, $iTTL = false)
    {
        if (file_exists($this->sPath . $sKey) && !is_writable($this->sPath . $sKey)) {
            return false;
        }
        if (!($rHandler = fopen($this->sPath . $sKey, 'w'))) {
            return false;
        }
        fwrite($rHandler, '<?php $mixedData=' . var_export($mixedData, true) . '; ?>');
        fclose($rHandler);
        @chmod($this->sPath . $sKey, 0666);
        return true;
    }