132
|
1 /*******************************************************************************
|
|
2
|
|
3
|
|
4 *******************************************************************************/
|
|
5
|
|
6 import tango.io.Stdout;
|
|
7
|
|
8 import tango.time.StopWatch;
|
|
9
|
|
10 import tango.util.log.Configurator;
|
|
11
|
|
12 import tango.net.cluster.NetworkCache;
|
|
13
|
|
14 import tango.net.cluster.tina.Cluster;
|
|
15
|
|
16 /*******************************************************************************
|
|
17
|
|
18
|
|
19 *******************************************************************************/
|
|
20
|
|
21 void main (char[][] args)
|
|
22 {
|
|
23 StopWatch w;
|
|
24
|
|
25 if (args.length > 1)
|
|
26 {
|
|
27 auto cluster = (new Cluster).join (args[1..$]);
|
|
28 auto cache = new NetworkCache (cluster, "my.cache.channel");
|
|
29
|
|
30 while (true)
|
|
31 {
|
|
32 w.start;
|
|
33 for (int i=10000; i--;)
|
|
34 cache.put ("key", cache.EmptyMessage);
|
|
35
|
|
36 Stdout.formatln ("{} put/s", 10000/w.stop);
|
|
37
|
|
38 w.start;
|
|
39 for (int i=10000; i--;)
|
|
40 cache.get ("key");
|
|
41
|
|
42 Stdout.formatln ("{} get/s", 10000/w.stop);
|
|
43 }
|
|
44 }
|
|
45 else
|
|
46 Stdout.formatln ("usage: cache cachehost:port ...");
|
|
47 }
|
|
48
|