Bluz\Cache\Adapter\PhpFile::doSet PHP Метод

doSet() защищенный Метод

protected doSet ( string $id, mixed $data, integer $ttl = Cache::TTL_NO_EXPIRY ) : integer
$id string
$data mixed
$ttl integer
Результат integer The number of bytes that were written to the file, or false on failure.
    protected function doSet($id, $data, $ttl = Cache::TTL_NO_EXPIRY)
    {
        if ($ttl > 0) {
            $ttl = time() + $ttl;
        }
        // if we have an array containing objects - we will have a problem.
        if (is_object($data) && !method_exists($data, '__set_state')) {
            throw new CacheException("Invalid argument given, PhpFileAdapter only allows objects that implement __set_state() " . "and fully support var_export().");
        }
        $fileName = $this->getFilename($id);
        $filePath = pathinfo($fileName, PATHINFO_DIRNAME);
        if (!is_dir($filePath)) {
            mkdir($filePath, 0777, true);
        }
        $cacheEntry = ['ttl' => $ttl, 'data' => $data];
        $cacheEntry = var_export($cacheEntry, true);
        $code = sprintf('<?php return %s;', $cacheEntry);
        return $this->writeFile($fileName, $code);
    }