src/Leevel/Cache/File.php
public function set(string $name, $data, array $option = []): void
    {
        $option = $this->normalizeOptions($option);

        if ($option['serialize']) {
            $data = serialize($data);
        }

        $data = sprintf(static::HEADER, '/* '.date('Y-m-d H:i:s').'  */').$data;

        $cachePath = $this->getCachePath($name);

        $this->writeData($cachePath, $data);
    }
public function set(string $name, $data, array $option = []): void
    {
        $option = $this->normalizeOptions($option);

        if ($option['serialize']) {
            $data = serialize($data);
        }

        $data = sprintf(static::HEADER, '/* '.date('Y-m-d H:i:s').'  */').$data;

        $cachePath = $this->getCachePath($name);

        $this->writeData($cachePath, $data);
    }
设置缓存.

@param string $name
@param mixed  $data
@param array  $option