19 package org.sleuthkit.autopsy.discovery.search;
 
   21 import com.google.common.cache.CacheBuilder;
 
   22 import com.google.common.cache.LoadingCache;
 
   23 import java.util.List;
 
   25 import java.util.concurrent.ExecutionException;
 
   36 class DomainSearchCache {
 
   38     private static final int MAXIMUM_CACHE_SIZE = 10;
 
   39     private static final LoadingCache<SearchKey, Map<GroupKey, List<Result>>> cache
 
   40             = CacheBuilder.newBuilder()
 
   41                     .maximumSize(MAXIMUM_CACHE_SIZE)
 
   42                     .build(
new DomainSearchCacheLoader());
 
   67     Map<GroupKey, List<Result>> 
get(String userName,
 
   68             List<AbstractFilter> filters,
 
   69             DiscoveryAttributes.AttributeType groupAttributeType,
 
   70             Group.GroupSortingAlgorithm groupSortingType,
 
   71             ResultsSorter.SortingMethod domainSortingMethod,
 
   72             SleuthkitCase caseDb, CentralRepository centralRepoDb, SearchContext context) 
throws DiscoveryException, SearchCancellationException {
 
   74             final SearchKey searchKey = 
new SearchKey(userName, filters, groupAttributeType,
 
   75                     groupSortingType, domainSortingMethod, caseDb, centralRepoDb, context);
 
   76             return cache.get(searchKey);
 
   77         } 
catch (ExecutionException ex) {
 
   78             throw new DiscoveryException(
"Error fetching results from cache", ex.getCause());