Commit c666ebdd authored by Akanksha Prasad's avatar Akanksha Prasad
Browse files

Using cursorCache

parent b8e17ec5
Pipeline #90448 failed with stages
in 10 minutes and 12 seconds
......@@ -69,10 +69,6 @@ public class QueryRepository implements IQueryRepository {
@Qualifier("CursorCache")
private ICache<String, String> cursorCache;
@Autowired
@Qualifier("CursorCache")
private ICache<String, String> continuationtoken_nexttable;
@Autowired
private DpsHeaders dpsHeaders;
......@@ -159,7 +155,7 @@ public class QueryRepository implements IQueryRepository {
try {
if (paginated) {
String continuation = null;
if (cursor == null || continuationtoken_nexttable.get(cursor) == storageSchemaContainer) {
if (cursor == null || cursorCache.get(cursor) == storageSchemaContainer) {
int remRecords = 0;
docPage = GetItemsPage(numRecords, cursor, storageSchemaContainer);
docs = docPage.getContent();
......@@ -170,27 +166,27 @@ public class QueryRepository implements IQueryRepository {
List<String> schemaInfoDocs = schemaInfoDocPage.getContent();
continuation = getContinuationToken(schemaInfoDocPage);
if (continuation != null) {
continuationtoken_nexttable.put(continuation, schemaInfoContainer);
cursorCache.put(continuation, schemaInfoContainer);
dqr.setCursor(continuation);
}
List<String> result = Stream.concat(schemaInfoDocs.stream(), docs.stream()).collect(Collectors.toList());
dqr.setResults(result);
} else if (continuation == null && docs.size() == numRecords) {
continuationtoken_nexttable.put("startofSchema", schemaInfoContainer);
cursorCache.put("startofSchema", schemaInfoContainer);
dqr.setCursor("startofSchema");
dqr.setResults(docs);
} else if (continuation != null) {
continuationtoken_nexttable.put(continuation, storageSchemaContainer);
cursorCache.put(continuation, storageSchemaContainer);
dqr.setCursor(continuation);
dqr.setResults(docs);
}
} else if (continuationtoken_nexttable.get(cursor) == schemaInfoContainer) {
} else if (cursorCache.get(cursor) == schemaInfoContainer) {
String newCursor = cursor.equals("startofSchema") == true ? null : cursor;
docPage = GetItemsPage(numRecords, newCursor, schemaInfoContainer);
docs = docPage.getContent();
continuation = getContinuationToken(docPage);
if (continuation != null) {
continuationtoken_nexttable.put(continuation, schemaInfoContainer);
cursorCache.put(continuation, schemaInfoContainer);
dqr.setCursor(continuation);
}
dqr.setResults(docs);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment