pool[$key])) { return false; } $this->pool[$key] = $cache; return true; } /** * Remove database. * * @param mixed $key Database key * * @return bool * * @since 1.0.0 */ public function remove(string $key) : bool { if (!isset($this->pool[$key])) { return false; } unset($this->pool[$key]); return true; } /** * Requesting caching instance. * * @param string $key Cache to request * * @return \phpOMS\DataStorage\Cache\CacheInterface * * @since 1.0.0 */ public function get(string $key = '') /* : ?CacheInterface */ { if ((!empty($key) && !isset($this->pool[$key])) || empty($this->pool)) { return null; } if (empty($key)) { return reset($this->pool); } return $this->pool[$key]; } /** * Create Cache. * * @param mixed $key Database key * @param array $config Database config data * * @return bool * * @since 1.0.0 */ public function create(string $key, array $config) : bool { if (isset($this->pool[$key])) { return false; } $this->pool[$key] = CacheFactory::create($config); return true; } }