Writes item into the cache.

@param string  $key
@param mixed   $data
@param mixed[] $dependencies
@phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
499038
public function write($key, $data, array $dependencies): void
	{
		$this->cachedStorage->write($key, $data, $dependencies);
		$this->memoryStorage->write($key, $data, $dependencies);
	}
598049
public function set($key, $data) {
        if ($this->persist) {
            $this->store[$key] = $data;
        }
        return true;
    }
154559
static function createFromData($key, array $data)
    {
        return new self(
            $key,
            isset($data[self::TYPE_CALL]) ? $data[self::TYPE_CALL] : null,
            isset($data[self::TYPE_TIME]) ? $data[self::TYPE_TIME] : null,
            isset($data[self::TYPE_CPU]) ? $data[self::TYPE_CPU] : null,
            isset($data[self::TYPE_MEMORY_USAGE]) ? $data[self::TYPE_MEMORY_USAGE] : null,
            isset($data[self::TYPE_PEAK_MEMORY_USAGE]) ? $data[self::TYPE_PEAK_MEMORY_USAGE] : null
        );
    }
326868
public function offsetSet($key, $data)
    {
        if (!$this->allow_modification) {
            throw new RuntimeException('Attempting to write to an immutable array');
        }

        if (isset($data) && is_array($data)) {
            $data = new static($data);
        }

        return parent::offsetSet($key, $data);
    }
905409
private function store($key, $data) 
    {
        $cachePath = $this->getCachePath($key);
        $cacheDir  = dirname($cachePath);
    
        if(!is_dir($cacheDir) && !@mkdir($cacheDir, 0755, true)) {
            throw new \wf\cache\Exception("Could not make cache directory");
        }
            
        if($this->isCompress && function_exists('gzdeflate') && function_exists('gzinflate')) {
            $data['value'] = gzdeflate($data['value']);
        }
        
        $text = "<?php\n# Auto generate by windwork cache engine,please don't edit me.\nreturn " . var_export($data, true) . ';';
        return @file_put_contents($cachePath, $text);
    }
1313834
public static function push($key, $data)
    {
        if (is_callable($data)) {
            $content = $data();
        } else {
            $content = $data;
        }

        static::$with_meta = true;

        $cache = static::get($key);

        static::$with_meta = false;

        if (is_array($cache['content'])) {
            array_push($cache['content'], $content);
        } else {
            $cache['content'] .= $content;
        }

        return (bool) file_put_contents(
            static::makeHashFilename($key),
            serialize($cache)
        );
    }
1260790
public function saveCache($cacheKey, $data, $cacheTags = [], $lifetime = self::DEFAULT_LIFETIME)
    {
        $this->localCache[$cacheKey] = $data;

        if (!is_string($data)) {
            $data = serialize($data);
        }

        $this->cache->save($data, $cacheKey, $cacheTags, $lifetime);
    }
1068117
public function setData($data, $key = '', $merge = false)
    {
        if ($key) {
            if ($merge && !empty($this->data[$key])) {
                $this->data[$key] = array_merge($this->data[$key], (array) $data);
            } else {
                $this->data[$key] = $data;
            }
        } else {
            if (is_object($data)) {
                $data = get_object_vars($data);
            }
            if (is_array($data)) {
                $this->data = array_merge($this->data, $data);
            }
        }
    }
1025485
public function put($key, $data)
    {

        $key = $this->getKeyCode($key);
        $data = json_encode($data);
        $this->memcacheObj->set($key, $data);
    }
873632
public void writeInjectDependenciesOnObject(Writer writer, String object, String... dependencies) throws IOException {
		if (dependencies != null && dependencies.length > 0) {
			writer.append(TAB).append(object).append(DOT).append("$inject").append(SPACEOPTIONAL).append(EQUALS).append(SPACEOPTIONAL).append(OPENBRACKET);
			writeDependencies(writer, "'", dependencies);
			writer.append(CLOSEBRACKET).append(SEMICOLON).append(CR);
		}
	}
531095
public function put($key, $item)
    {
        $file = $this->filename($key);

        // json
        // text
        if (!file_put_contents($file, serialize($item))) {
            throw new \Exception(
                t("Failed writing cache object '!key'.", [
                    '!key' => $key
                ])
            );
        }
    }
399599
public function writeStyle($name, $source, $dependencies = array())
    {
        $source = '<style>'.$source.'</style>';

        return $this->write($name, 'style', $source, $dependencies);
    }
574231
protected function resolveDependencies(array $dependencies)
    {
        foreach ($dependencies as $dependency => $type) {
            call_user_func_array([$this, $type], [$dependency]);
        }
    }
700454
public static function insert($key, $data)
    {
        if (self::$configurator instanceof ConfiguratorClass) {
            return self::$configurator->insert($key, $data);
        } else {
            return null;
        }
    }
1132873
public function setExtraByKey($key, $data)
    {
        $data = $this->hydrateIfJsonToArray($data);
        $this->extra[$key] = $data;
    }
1095076
function createDependencyTree( &$dependenciesNode, $dependencyType, $list )
    {
        $dom = $dependenciesNode->ownerDocument;

        foreach ( $list as $dependencyItem )
        {
            unset( $dependencyNode );
            $dependencyNode = $dom->createElement( $dependencyType );
            $dependencyNode->setAttribute( 'type', $dependencyItem['type'] );
            $dependencyNode->setAttribute( 'name', $dependencyItem['name'] );
            if ( $dependencyItem['value'] )
                $dependencyNode->setAttribute( 'value', $dependencyItem['value'] );
            $dependenciesNode->appendChild( $dependencyNode );
            $handler = $this->packageHandler( $dependencyItem['name'] );
            if ( $handler )
            {
                $handler->createDependencyNode( $this, $dependencyNode, $dependencyItem, $dependencyType );
            }
        }
    }
961207
public function write($key, $data) {
        $cache = Zend_Registry::get('CacheFrontend');
        // include the current version in the cached results
        $version = (int)$cache->load($this->_versionKey);
        // save the data to cache but include the version number
        return $cache->save(
            array(
                'data' => $data,
                'version' => $version
            ),
            $key
        );
    }