/// <summary> /// Used to get the number of records of the cache /// </summary> /// <returns>Current number of records in the cache</returns> public int size() { StatsOperation op = operationsFactory.newStatsOperation(); transport = transportFactory.getTransport(); try { } finally { transportFactory.releaseTransport(transport); } return(int.Parse(op.executeOperation(this.transport)[ServerStatistics.CURRENT_NR_OF_ENTRIES])); }
public void executeOperationTest() { TCPTransport trans = new TCPTransport(System.Net.IPAddress.Loopback, 11222); Codec codec = new Codec(); byte[] cacheName = null; int topologyId = 0; Flag[] flags = null; StatsOperation target = new StatsOperation(codec, cacheName, topologyId, flags); Transport transport = trans; string expected = ""; Dictionary <string, string> actual; actual = target.executeOperation(transport); Assert.AreEqual(expected, actual[ServerStatistics.CURRENT_NR_OF_ENTRIES]); }
/// <summary> /// Used to retreive statistical information about the remote cache /// </summary> /// <returns>Server Statistics</returns> public ServerStatistics stats() { StatsOperation op = operationsFactory.newStatsOperation(); transport = transportFactory.getTransport(); try { } finally { transportFactory.releaseTransport(transport); } Dictionary <String, String> statsMap = (Dictionary <String, String>)op.executeOperation(this.transport); ServerStatistics stats = new ServerStatistics(); for (int i = 0; i < statsMap.Count; i++) { stats.addStats(statsMap.ElementAt(i).Key, statsMap.ElementAt(i).Value); } return(stats); }