Skip to content

Commit 78e23d7

Browse files
author
a-brandt
committed
added test for query caching
1 parent 22f2cad commit 78e23d7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/java/com/arangodb/ArangoDriverDocumentCursorTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,24 @@ public void test3_BatchSize5() throws ArangoException {
155155
@Test
156156
public void test_withCache() throws ArangoException {
157157
if (isMinimumVersion(VERSION_2_7)) {
158+
// start caching
158159
QueryCachePropertiesEntity properties = new QueryCachePropertiesEntity();
159160
properties.setMode("on");
160161
driver.setQueryCacheProperties(properties);
161162

162163
String query = "FOR t IN unit_test_query_test FILTER t.age >= @age SORT t.age RETURN t";
163164
Map<String, Object> bindVars = new MapBuilder().put("age", 90).get();
164165

166+
// set caching to true for the query
165167
AqlQueryOptions aqlQueryOptions = getAqlQueryOptions(true, 5, null);
166168
aqlQueryOptions.setCache(true);
167169

170+
// query
168171
DocumentCursor<TestComplexEntity01> rs = driver.executeDocumentQuery(query, bindVars, aqlQueryOptions,
169172
TestComplexEntity01.class);
170173

174+
// query the cached value
171175
rs = driver.executeDocumentQuery(query, bindVars, aqlQueryOptions, TestComplexEntity01.class);
172-
173176
assertThat(rs.isCached(), is(true));
174177
}
175178
}

0 commit comments

Comments
 (0)