// Create the doc search cache and register a region master searcher
_documentSearchCache = new EHCachingSearchCache(name + "Region", cacheManager, new EHCachingSearchCache.Searcher() {
@Override
public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
// Fetch search results from underlying master
RegionSearchResult result = ((RegionMaster) getUnderlying()).search((RegionSearchRequest)
EHCachingSearchCache.withPagingRequest((RegionSearchRequest) 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 security master searcher
_historySearchCache = new EHCachingSearchCache(name + "RegionHistory", cacheManager, new EHCachingSearchCache.Searcher() {
@Override
public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
// Fetch search results from underlying master
RegionHistoryResult result = ((RegionMaster) getUnderlying()).history((RegionHistoryRequest)
EHCachingSearchCache.withPagingRequest((RegionHistoryRequest) 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
RegionSearchRequest defaultSearch = new RegionSearchRequest();