public function cmdClearCache()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (!isset($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (isset($id)) {
            $pattern = $this->getParam('pattern');
            if (isset($pattern)) {
                $result = $this->cache->clear($id, array('pattern' => $pattern));
            } else {
                $result = $this->cache->clear($id);
            }
        } else if ($all) {
            $result = $this->cache->clear(null);
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }