/** * 清洗已经存储的所有元素 * */ public function truncate() { foreach ($this->conf['server'] as $key => $val) { if (!isset($this->redis[$key]) || !is_object($this->redis[$key])) { $instance = new \Redis(); if ($instance->pconnect($val['host'], $val['port'], 1.5)) { $this->redis[$key] = $instance; } else { throw new \RuntimeException(Lang::get('_CACHE_NEW_INSTANCE_ERROR_', 'Redis')); } } $this->redis[$key]->flushDB(); } return true; }