@Test public void testRefresh() { final CacheKeySuffixTransformer<String> transformer = context.mock(CacheKeySuffixTransformer.class); final Cache cache = context.mock(Cache.class); final String request = "abcdefg"; final String suffix = "hijklmnop"; final List<Long> response = new ArrayList<Long>(); context.checking(new Expectations() { { oneOf(transformer).transform(request); will(returnValue(suffix)); oneOf(cache).setList("PREFIXhijklmnop", response); } }); SingleListValueCacheRefreshStrategy<String> sut = new SingleListValueCacheRefreshStrategy<String>("PREFIX", transformer); sut.setCache(cache); sut.refresh(request, response); context.assertIsSatisfied(); }
@Override public void refresh(final Request inRequest, final List<Long> inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (log.isTraceEnabled()) { log.trace("Setting List<Long> of size " + (inResponse == null ? "(null)" : inResponse.size()) + " to cache with cache key: " + cacheKeyPrefix + cacheKeySuffix); } getCache().setList(cacheKeyPrefix + cacheKeySuffix, inResponse); }
SingleListValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, List<Long>> { @Override public void refresh(final Request inRequest, final List<Long> inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (log.isTraceEnabled()) { log.trace("Setting List<Long> of size " + (inResponse == null ? "(null)" : inResponse.size()) + " to cache with cache key: " + cacheKeyPrefix + cacheKeySuffix); } getCache().setList(cacheKeyPrefix + cacheKeySuffix, inResponse); } }
SingleListValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, List<Long>> { @Override public void refresh(final Request inRequest, final List<Long> inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (log.isTraceEnabled()) { log.trace("Setting List<Long> of size " + (inResponse == null ? "(null)" : inResponse.size()) + " to cache with cache key: " + cacheKeyPrefix + cacheKeySuffix); } getCache().setList(cacheKeyPrefix + cacheKeySuffix, inResponse); } SingleListValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final CacheKeySuffixTransformer<Request> inCacheKeySuffixTransformer); }
SingleListValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, List<Long>> { @Override public void refresh(final Request inRequest, final List<Long> inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (log.isTraceEnabled()) { log.trace("Setting List<Long> of size " + (inResponse == null ? "(null)" : inResponse.size()) + " to cache with cache key: " + cacheKeyPrefix + cacheKeySuffix); } getCache().setList(cacheKeyPrefix + cacheKeySuffix, inResponse); } SingleListValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final CacheKeySuffixTransformer<Request> inCacheKeySuffixTransformer); @Override void refresh(final Request inRequest, final List<Long> inResponse); }
SingleListValueCacheRefreshStrategy extends CachedDomainMapper implements
        RefreshStrategy<Request, List<Long>> { @Override public void refresh(final Request inRequest, final List<Long> inResponse) { String cacheKeySuffix = cacheKeySuffixTransformer.transform(inRequest); if (log.isTraceEnabled()) { log.trace("Setting List<Long> of size " + (inResponse == null ? "(null)" : inResponse.size()) + " to cache with cache key: " + cacheKeyPrefix + cacheKeySuffix); } getCache().setList(cacheKeyPrefix + cacheKeySuffix, inResponse); } SingleListValueCacheRefreshStrategy(final String inCacheKeyPrefix,
            final CacheKeySuffixTransformer<Request> inCacheKeySuffixTransformer); @Override void refresh(final Request inRequest, final List<Long> inResponse);  }