Code example for MapMaker

  private static final String CACHE_NAME = "TempTargetRepository";
  private final TempTargetRepository _underlying;
  private final ConcurrentMap<UniqueId, TempTarget> _frontCache = new MapMaker().weakValues().makeMap();
  private final Cache _cache; 
  private boolean _running;
  public EHCachingTempTargetRepository(final TempTargetRepository underlying, final CacheManager cacheManager) {
    ArgumentChecker.notNull(underlying, "underlying");
    _underlying = underlying;
    EHCacheUtils.addCache(cacheManager, CACHE_NAME);
    // TODO: This needs to be "in-memory" only 
    _cache = EHCacheUtils.getCacheFromManager(cacheManager, CACHE_NAME);
  protected TempTargetRepository getUnderlying() { 
Contextual code suggestions in your IDE  Get Codota for Java