/** * {@inheritdoc} * * @param string $prefix * @return array */ public function queryKeys($prefix = null) { if (!$prefix) { $prefix = $this->_prefix; } else { $prefix = $this->getPrefixedIdentifier($prefix); } $keys = []; $globalPrefix = $this->_prefix; $this->db->scan($this->namespace, $this->set, function ($record) use(&$keys, $prefix, $globalPrefix) { $key = $record['key']['key']; if (empty($prefix) || 0 === strpos($key, $prefix)) { $keys[] = preg_replace(sprintf('#^%s(.+)#u', preg_quote($globalPrefix)), '$1', $key); } }); return $keys; }