setCacheKey($cacheKey); } /** * Overwrites a previously set cache key. Useful if you want to reuse the same instance for different cache keys * for performance reasons. * @param string $cacheKey */ public function setCacheKey($cacheKey) { $this->cacheKey = $this->completeKey($cacheKey); } /** * Get the content related to the current cache key. Make sure to call the method {@link has()} to verify whether * there is actually any content set under this cache key. * @return mixed */ public function get() { return self::$staticCache[$this->cacheKey]; } /** * Check whether any content was actually stored for the current cache key. * @return bool */ public function has() { return array_key_exists($this->cacheKey, self::$staticCache); } /** * Reset the stored content of the current cache key. */ public function clear() { unset(self::$staticCache[$this->cacheKey]); } /** * Set (overwrite) any content related to the current set cache key. * @param $content */ public function set($content) { self::$staticCache[$this->cacheKey] = $content; } protected function completeKey($cacheKey) { return $cacheKey; } }