Airship\Engine\Cache\File::set PHP Method

set() public method

Set a cache entry
public set ( string $key, $value ) : boolean
$key string
$value
return boolean
    public function set(string $key, $value) : bool
    {
        $path = $this->getRelativePath($key);
        // Let's make sure both directories exist
        $dirs = self::getRelativeHash($this->baseDir . DIRECTORY_SEPARATOR . $key);
        $dirName = \implode(DIRECTORY_SEPARATOR, [$this->baseDir, $dirs[0]]);
        if (!\is_dir($dirName)) {
            \mkdir($dirName, self::PERMS);
        }
        $dirName .= DIRECTORY_SEPARATOR . $dirs[1];
        if (!\is_dir($dirName)) {
            \mkdir($dirName, self::PERMS);
        }
        // Now let's store our data in the file
        return \file_put_contents($path, \json_encode($value)) !== false;
    }