// Create the document search cache and register a historicalTimeSeries master searcher
_documentSearchCache = new EHCachingSearchCache(name + "HistoricalTimeSeries", cacheManager, new EHCachingSearchCache.Searcher() {
@Override
public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
// Fetch search results from underlying master
HistoricalTimeSeriesInfoSearchResult result = ((HistoricalTimeSeriesMaster) getUnderlying()).search((HistoricalTimeSeriesInfoSearchRequest)
EHCachingSearchCache.withPagingRequest(request, pagingRequest));
// Cache the result documents
EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());
// Return the list of result UniqueIds
return new ObjectsPair<>(result.getPaging().getTotalItems(),
EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
}
});
// Create the history search cache and register a historicalTimeSeries master searcher
_historySearchCache = new EHCachingSearchCache(name + "HistoricalTimeSeriesHistory", cacheManager, new EHCachingSearchCache.Searcher() {
@Override
public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
// Fetch search results from underlying master
HistoricalTimeSeriesInfoHistoryResult result = ((HistoricalTimeSeriesMaster) getUnderlying()).history((HistoricalTimeSeriesInfoHistoryRequest)
EHCachingSearchCache.withPagingRequest(request, pagingRequest));
// Cache the result documents
EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());
// Return the list of result UniqueIds
return new ObjectsPair<>(result.getPaging().getTotalItems(),
EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
}
});
// Prime document search cache
HistoricalTimeSeriesInfoSearchRequest defaultSearch = new HistoricalTimeSeriesInfoSearchRequest();