@@ -40,23 +40,14 @@ private void initializeCache() {
40
40
// Create Cache
41
41
Configuration cacheManagerConfig = new Configuration ();
42
42
43
- // ***To Cluster With Terracotta***
44
- // add the ehcache-terracotta-ee jar to your class path and uncomment
45
- // the
46
- // code in the "To Cluster With Terracotta" sections
47
- //
48
43
// TerracottaClientConfiguration tcConfig = new
49
44
// TerracottaClientConfiguration()
50
45
// .url("localhost:9510");
51
46
// cacheManagerConfig.addTerracottaConfig(tcConfig);
52
47
53
- // ***To Cluster With Terracotta***
54
-
55
48
CacheConfiguration cacheConfig = new CacheConfiguration ("test" , -1 )
56
49
.eternal (true )
57
- // ***To Cluster With Terracotta***
58
50
// .terracotta(new TerracottaConfiguration())
59
- // ***To Cluster With Terracotta***
60
51
;
61
52
Searchable searchable = new Searchable ();
62
53
cacheConfig .addSearchable (searchable );
@@ -104,20 +95,18 @@ public void runTests() throws IOException {
104
95
Attribute <Gender > gender = cache .getSearchAttribute ("gender" );
105
96
Attribute <String > name = cache .getSearchAttribute ("name" );
106
97
Attribute <String > state = cache .getSearchAttribute ("state" );
107
-
98
+
108
99
Query query = cache .createQuery ();
109
100
query .includeKeys ();
110
101
query .includeValues ();
111
102
query .addCriteria (name .ilike ("Ari*" ).and (gender .eq (Gender .MALE )))
112
103
.addOrderBy (age , Direction .ASCENDING ).maxResults (10 );
113
104
114
- long t = System .currentTimeMillis ();
115
105
System .out
116
106
.println ("Searching for all Person's who's name start with Ari and are Male:" );
117
107
118
108
Results results = query .execute ();
119
- System .out .println ("Took: " + (System .currentTimeMillis () - t )
120
- + " Size: " + results .size ());
109
+ System .out .println (" Size: " + results .size ());
121
110
System .out .println ("----Results-----\n " );
122
111
for (Result result : results .all ()) {
123
112
System .out .println ("Got: Key[" + result .getKey ()
@@ -132,12 +121,10 @@ public void runTests() throws IOException {
132
121
cache .put (new Element (1 , new Person ("Ari Eck" , 36 , Gender .MALE ,
133
122
"eck street" , "San Mateo" , "CA" )));
134
123
135
- t = System .currentTimeMillis ();
136
124
System .out
137
125
.println ("Again Searching for all Person's who's name start with Ari and are Male:" );
138
126
results = query .execute ();
139
- System .out .println ("Took: " + (System .currentTimeMillis () - t )
140
- + " Size: " + results .size ());
127
+ System .out .println (" Size: " + results .size ());
141
128
142
129
read ();
143
130
0 commit comments