/** * 切换配置文件 * @param string $zone * @return array */ static function useConfig($zone, $type = "host") { $hosts = array(); $options = array(); $config = self::getConfig($zone, $type); if (empty($config)) { trigger_error("the redis hosts is not set in config file(" . self::$_config . ")"); return false; } if (is_array($config)) { $hosts = $config; } else { $hosts[] = $config; } $config = self::getConfig($zone, "options"); if (!empty($config)) { if (is_object($config)) { foreach ($config as $k => $v) { $options[$k] = $v; } } } self::$_rc = new RedisArray($hosts, $options); }
public static function __callStatic($name, $args) { try { if (self::$_rc) { return call_user_func_array(array(self::$_rc, $name), $args); } } catch (RedisException $e) { self::$_instances = null; self::$_rc = null; trigger_error($e); } return false; }