protected override IGetOperationResult PerformTryGet(string key, out ulong cas, out object value) { string str = base.KeyTransformer.Transform(key); IMemcachedNode startNode = base.Pool.Locate(str); IGetOperationResult source = base.GetOperationResultFactory.Create(); if (startNode != null) { IGetOperation op = base.Pool.OperationFactory.Get(str); IOperationResult result2 = this.ExecuteWithRedirect(startNode, op); if (result2.Success) { source.Value = value = op.Result.Data; // base.Transcoder.Deserialize(op.Result); source.Cas = cas = op.CasValue; if (base.PerformanceMonitor != null) { base.PerformanceMonitor.Get(1, true); } source.Pass(null); return(source); } value = null; cas = 0L; result2.Combine(source); return(source); } value = null; cas = 0L; if (base.PerformanceMonitor != null) { base.PerformanceMonitor.Get(1, false); } source.Fail("Unable to locate node", null); return(source); }
public IGetResponse GetDocuments(IGetOperation operation) { if (Authorize(operation, false)) { return(_nodeContext.TopologyImpl.GetDocuments(operation)); } return(null); }
public IGetResponse GetDocuments(IGetOperation operation) { DatabaseExists(operation.Database); IStore database = _databases[operation.Database]; return(database.GetDocuments(operation)); }
/// <summary> /// Gets the Node configuration from "config get cluster" if it's new or "get AmazonElastiCache:cluster" if it's older than /// 1.4.14 /// </summary> /// <returns>A string in the format "hostname1|ip1|port1 hostname2|ip2|port2 ..."</returns> internal string GetNodeConfig() { var tries = this.tries; var nodeVersion = this.GetNodeVersion(); var older = new Version("1.4.14"); var waiting = true; string message = ""; string[] items = null; IGetOperation command = nodeVersion.CompareTo(older) < 0 ? command = new GetOperation("AmazonElastiCache:cluster") : command = new ConfigGetOperation("cluster"); while (waiting && tries > 0) { tries--; try { lock (nodesLock) { // This avoids timing out from requesting the config from the endpoint foreach (var node in this.nodes.ToArray()) { try { var result = node.Execute(command); if (result.Success) { var configCommand = command as IConfigOperation; items = Encoding.UTF8.GetString(configCommand.ConfigResult.Data.Array, configCommand.ConfigResult.Data.Offset, configCommand.ConfigResult.Data.Count).Split('\n'); waiting = false; break; } else { message = result.Message; } } catch (Exception ex) { message = ex.Message; } } } if (waiting) { System.Threading.Thread.Sleep(this.delay); } } catch (Exception ex) { message = ex.Message; System.Threading.Thread.Sleep(this.delay); } } if (waiting) { throw new TimeoutException(String.Format("Could not get config of version " + this.NodeVersion.ToString() + ". Tries: {0} Delay: {1}. " + message, this.tries, this.delay)); } lock (clusterLock) { if (this.ClusterVersion < Convert.ToInt32(items[0])) { this.ClusterVersion = Convert.ToInt32(items[0]); } } return(items[1]); }