public function __construct($name = null) { $this->load_config($name); if ($this->config['driver'] == 'file') { $this->check_file_config($name); } $driver = 'Cache_Driver_' . $this->config['driver']; if (!class_exists($driver, true)) { throw new Exception(__('The :type driver :driver does not exist', array(':type' => 'Cache', ':driver' => $this->config['driver']))); } $this->driver = new $driver($this->config['driver_config']); # 设置前缀 if ($this->config['prefix']) { $this->driver->set_prefix($this->config['prefix']); } }
/** * 设置前缀 * * @param string $prefix * @return $this */ public function set_prefix($prefix) { $this->driver->set_prefix($prefix); return $this; }