@Override protected void addResponseImpl(String key, HttpResponse response) { cache.addElement(key, response); }
public void put(String expression, Tree tree) { resolvedTreeCache.addElement(expression, tree); } };
@Override protected void addResponseImpl(String key, HttpResponse response) { cache.addElement(key, response); }
public void put(String expression, Tree tree) { resolvedTreeCache.addElement(expression, tree); } };
public void put(String expression, Tree tree) { resolvedTreeCache.addElement(expression, tree); } };
/** * Invalidate all fetched content that was signed on behalf of the specified set of users. * * @param opensocialIds * @param token */ public void invalidateUserResources(Set<String> opensocialIds, SecurityToken token) { for (String userId : opensocialIds) { // Allocate a new mark for each user invalidationEntries.addElement(getKey(userId, token), marker.incrementAndGet()); } }
public void store(Key k, List<? extends Job> derivatives) { if (!(k instanceof ModuleCacheKey)) { throw new IllegalArgumentException(k.getClass().getName()); } ModuleCacheKey key = (ModuleCacheKey) k; backingCache.addElement(key, cloneJobs(derivatives)); }
/** * Invalidate all fetched content that was signed on behalf of the specified set of users. * * @param opensocialIds * @param token */ public void invalidateUserResources(Set<String> opensocialIds, SecurityToken token) { for (String userId : opensocialIds) { // Allocate a new mark for each user invalidationEntries.addElement(getKey(userId, token), marker.incrementAndGet()); } }
/** * Invalidate all fetched content that was signed on behalf of the specified set of users. * * @param opensocialIds * @param token */ public void invalidateUserResources(Set<String> opensocialIds, SecurityToken token) { for (String userId : opensocialIds) { // Allocate a new mark for each user invalidationEntries.addElement(getKey(userId, token), marker.incrementAndGet()); } }
/** * Add an element to the cache, with the intended max age for its cache entry provided in * milliseconds. * * @param key The key to store the entry for. * @param value The value to store. * @param maxAge The maximum age for this entry before it is deemed expired. */ public void addElement(K key, V value, long maxAge) { long now = timeSource.currentTimeMillis(); cache.addElement(key, value); expirationTimes.put(value, now + maxAge); }
/** * Add an element to the cache, with the intended max age for its cache entry provided in * milliseconds. * * @param key The key to store the entry for. * @param value The value to store. * @param maxAge The maximum age for this entry before it is deemed expired. */ public void addElement(K key, V value, long maxAge) { long now = timeSource.currentTimeMillis(); cache.addElement(key, value); expirationTimes.put(value, now + maxAge); }
/** * Add an element to the cache, with the intended max age for its cache entry provided in * milliseconds. * * @param key The key to store the entry for. * @param value The value to store. * @param maxAge The maximum age for this entry before it is deemed expired. */ public void addElement(K key, V value, long maxAge) { long now = timeSource.currentTimeMillis(); cache.addElement(key, value); expirationTimes.put(value, now + maxAge); }
/** * Add an element to the cache, with the intended max age for its cache entry provided in * milliseconds. * * @param key The key to store the entry for. * @param value The value to store. * @param maxAge The maximum age for this entry before it is deemed expired. */ public void addElement(K key, V value, long maxAge) { long now = timeSource.currentTimeMillis(); cache.addElement(key, value); expirationTimes.put(value, now + maxAge); }
@Override public CompileResult call() throws Exception { // Create the options anew. Passing in the parent options, even cloning it, is not thread safe. CompileResult result = doCompileContent(content, getCompilerOptions(jsUri), buildExterns(externs)); synchronized (compiling) { // Other threads should pick this up in the cache now. cache.addElement(cacheKey, result); compiling.remove(cacheKey); } return result; } });
@Test public void getResponse() { HttpRequest request = new HttpRequest(DEFAULT_URI); HttpResponse response = new HttpResponse("response"); String key = httpCache.createKey(request); cache.addElement(key, response); assertEquals(response, httpCache.getResponse(request)); }
@Test public void getResponse() { HttpRequest request = new HttpRequest(DEFAULT_URI); HttpResponse response = new HttpResponse("response"); String key = httpCache.createKey(request); cache.addElement(key, response); assertEquals(response, httpCache.getResponse(request)); }
@Test public void getResponse() { HttpRequest request = new HttpRequest(DEFAULT_URI); HttpResponse response = new HttpResponse("response"); String key = httpCache.createKey(request); cache.addElement(key, response); assertEquals(response, httpCache.getResponse(request)); }
@Test public void removeResponse() { HttpRequest request = new HttpRequest(DEFAULT_URI); HttpResponse response = new HttpResponse("response"); String key = httpCache.createKey(request); cache.addElement(key, response); assertEquals(response, httpCache.removeResponse(request)); assertEquals(0, cache.getSize()); } }
@Test public void removeResponse() { HttpRequest request = new HttpRequest(DEFAULT_URI); HttpResponse response = new HttpResponse("response"); String key = httpCache.createKey(request); cache.addElement(key, response); assertEquals(response, httpCache.removeResponse(request)); assertEquals(0, cache.getSize()); } }
@Test public void removeResponse() { HttpRequest request = new HttpRequest(DEFAULT_URI); HttpResponse response = new HttpResponse("response"); String key = httpCache.createKey(request); cache.addElement(key, response); assertEquals(response, httpCache.removeResponse(request)); assertEquals(0, cache.getSize()); } }