/** * Retrieve an element from the cache by key. If there is no such element * for that key in the cache, or if the element has timed out, null is returned. * @param key Key whose element to look up. * @return Element in the cache, if present and not timed out. */ public CachedObject<V> getElement(K key) { V value = cache.getElement(key); if (value == null) { return null; } Long expiration = expirationTimes.get(value); if (expiration == null) { return null; } return new CachedObject<V>(value, expiration < timeSource.currentTimeMillis()); }
/** * Retrieve an element from the cache by key. If there is no such element * for that key in the cache, or if the element has timed out, null is returned. * @param key Key whose element to look up. * @return Element in the cache, if present and not timed out. */ public CachedObject<V> getElement(K key) { V value = cache.getElement(key); if (value == null) { return null; } Long expiration = expirationTimes.get(value); if (expiration == null) { return null; } return new CachedObject<V>(value, expiration < timeSource.currentTimeMillis()); }
/** * Retrieve an element from the cache by key. If there is no such element * for that key in the cache, or if the element has timed out, null is returned. * @param key Key whose element to look up. * @return Element in the cache, if present and not timed out. */ public CachedObject<V> getElement(K key) { V value = cache.getElement(key); if (value == null) { return null; } Long expiration = expirationTimes.get(value); if (expiration == null) { return null; } return new CachedObject<V>(value, expiration < timeSource.currentTimeMillis()); }
/** * Retrieve an element from the cache by key. If there is no such element * for that key in the cache, or if the element has timed out, null is returned. * @param key Key whose element to look up. * @return Element in the cache, if present and not timed out. */ public CachedObject<V> getElement(K key) { V value = cache.getElement(key); if (value == null) { return null; } Long expiration = expirationTimes.get(value); if (expiration == null) { return null; } return new CachedObject<V>(value, expiration < timeSource.currentTimeMillis()); }
/** * Retrieve an element from the cache by key. If there is no such element * for that key in the cache, or if the element has timed out, null is returned. * @param key Key whose element to look up. * @return Element in the cache, if present and not timed out. */ public CachedObject<V> getElement(K key) { V value = cache.getElement(key); if (value == null) { return null; } Long expiration = expirationTimes.get(value); if (expiration == null) { return null; } return new CachedObject<V>(value, expiration < timeSource.currentTimeMillis()); }