Caching template.

@param string $key
@param mixed $value
@param int $expire
@param array $tags
327652
protected function setCacheContent($key = null, $value = null, $expire = 0, array $tags = [])
    {
        if ($this->cache instanceof CacheInterface && isset($key)) {
            if (!empty($this->cachePlaceholders)) {
                $result = $value;
                $value = [];
                $value['result'] = $result;
                $value['placeholders'] = $this->cachePlaceholders;
            }
            $this->cache->set(
                $key,
                $value,
                $expire,
                is_string($tags) ? explode(',', $tags) : $tags
            );
            $this->cachePlaceholders = [];
        }
    }
621999
public function set($key, $value, $expireTime = null)
    {
        if ( $expireTime && !is_int($expireTime) )
        {
            throw new \InvalidArgumentException('cache expire time must be integer.');
        }

        $this->expireTime = ($expireTime) ? $expireTime : $this->expireTime;

        return $this->write($key, $value);
    }
1215778
public static function set(string $key, $value, int $expire = null): bool
    {
        return self::storage()->set($key, $value, $expire);
    }
395930
protected function write(array $keys, $expire = null)
    {
        foreach ($keys as $k => $v) {
            $k = sha1($k);
            $this->memcache->set($k, $v, 0, $expire);
        }

        return true;
    }
28360
public function setDueDate($key, $value, $expirationTime, array $tags = null)
    {
        return $this->set($key, $value, $expirationTime - time(), $tags);
    }
1092184
public static function set($key, $value) {
		$memcache = self::connect();
		$config = \Skeleton\Object\Config::$cache_handler_config;
		$memcache->add($key, $value, false, $config['expire']);
	}
1049324
public function set(string $key, $value, int $expire = null): bool {
		if ($value instanceof Closure) {
			$value = $value();
		}
		return $this->driver->set($key, static::serialize($value), $expire ?? $this->expire);
	}
1145340
public function setWithExpire($key, $value, $expire)
    {
        if (setcookie($key, $value, time() + $expire, '/', '', false, true)) {
            return true;
        }
        return false;
    }
833157
public function set($key, $value, int $expire = 30) : Cookies
    {
        setcookie($key, $value, time() + $expire);

        return $this;
    }
518190
public function set($key, $value, $expire = 0)
    {
        if ($this->type === 1) {
            return $this->memcache->set($key, $value, $expire);
        } else {
            return $this->memcache->set($this->conf['prefix'] . $key, json_encode($value, JSON_UNESCAPED_UNICODE), false, $expire);
        }
    }
397509
public function addCacheTag($key, $value)
    {
        if ($this->runtimeContentCache->getEnableContentCache() === false) {
            return;
        }
        $this->runtimeContentCache->addTag($key, $value);
    }
400386
public function set($key, $value, $expire = 0)
    {
        if ($this->expire) {
            $expire = $this->expire;
        }

        return $this->handle->set($key, $value, $expire);
    }
20307
public function store($key, $value, $expiration = 0)
    {
        // $this->getTimeout(); Do delete based on the session time out
        $data = [
            'time'   => time(),
            'expire' => $expiration,
            'data'   => $value,
        ];

        if ($this->where == true) {
            $this->setCache($key)
                 ->setPath(CYGNITE_BASE.DS.toPath('public.storage.cache').DS);
        }

        if (is_array($this->getCache())) {
            $array = $this->getCache();
            $array[$key] = $data;
        } else {
            $array = [$key => $data];
        }

        $cacheData = json_encode($array);

        if ($this->getDirectory() == true) {
            @file_put_contents($this->getDirectory(), $cacheData);
        }

        return $this;
    }
163337
function set($key, $value, $expire = 0)
    {
        if ($this->memcached)
        {
            return $this->cache->set($key, $value, $expire);
        }
        else
        {
            return $this->cache->set($key, $value, $this->flags, $expire);
        }
    }
1079189
public function set($key, $value, $expiration = false)
    {
        $path = $this->filename($key);
        $umask = umask($this->umask);
        file_put_contents($path, $this->createValue($value, $expiration));
        umask($umask);
        return $this;
    }
594413
function set($key, $value, $expire = 0)
    {
        // 如果是对象，需要进行序列号存储
        if (is_array($value) || is_object($value)) {
            $value = serialize($value);
        }

        if ($expire > 0) {
            return $this->connection->setex($key, $expire, $value);
        } else {
            return $this->connection->set($key, $value);
        }
    }
814448
public function set($key, $data, $expire = 0) {
		if ($data instanceof ModelArray) {
			$modelArray = explode('\\', get_class($data[0]));
			$modelName = count($data) == 0 ? '': end($modelArray);
			$data = [
				'__fsm' => [
					'm' => $modelName,
					'a' => 1
				],
				'data' => $data->toArray()
			];
		} else if ($data instanceof Model) {
			$modelArray = explode('\\', get_class($data));
			$modelName = count($data) == 0 ? '': end($modelArray);
			$data = [
				'__fsm' => [
					'm' => $modelName,
					'a' => 0
				],
				'data' => $data->toArray()
			];
		}
		//print_r($data);
		CacheFactory::getCache()->set($key, $data, $expire);
	}