Task <string> IStringCommands.GetString(int db, string key, int start, int end, bool queueJump) { RedisFeatures features = Features; RedisLiteral cmd = features != null && features.Version < RedisFeatures.v2_1_0 ? RedisLiteral.SUBSTR : RedisLiteral.GETRANGE; return(ExecuteString(RedisMessage.Create(db, cmd, key, start, end), queueJump)); }
private void ProcessInfo(string done) { try { // process this when available Dictionary <string, string> parsed = ParseInfo(done); string s; Version version; if (parsed.TryGetValue("redis_version", out s) && TryParseVersion(s, out version)) { ServerVersion = version; } if (parsed.TryGetValue("redis_mode", out s) && s == "sentinel") { ServerType = ServerType.Sentinel; } else if (parsed.TryGetValue("role", out s) && s != null) { switch (s) { case "master": ServerType = ServerType.Master; break; case "slave": ServerType = ServerType.Slave; break; } if (!string.IsNullOrEmpty(name)) { RedisFeatures tmp = Features; if (tmp != null && tmp.ClientName) { ExecuteVoid( RedisMessage.Create(-1, RedisLiteral.CLIENT, RedisLiteral.SETNAME, name), true); } } } Interlocked.CompareExchange(ref state, (int)ConnectionState.Open, (int)ConnectionState.Opening); } catch { Close(true); Interlocked.CompareExchange(ref state, (int)ConnectionState.Closed, (int)ConnectionState.Opening); } }