/** * 执行命令 * db.ttl.ensureIndex({"Date": 1}, {expireAfterSeconds: 300}) */ public static function cmd($paramArr) { $options = array('module' => false, 'cmd' => false, 'retry' => true); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!$module || !isset(self::$_cacheCfg[$module])) { return false; } $cfg = self::$_cacheCfg[$module]["write"]; #服务器数据 $server = $cfg["server"]; $db = $module; $data = false; try { $data = API_MongoDB::doCmd($server, $db, $cmd); } catch (Exception $e) { if (!empty($options['retry'])) { $options['retry'] = false; $data = self::cmd($options); } } return $data; }