/** * Take an entry (which may be null) and return that entry only if not expired. If expired, return a null. If the * entry is expired, it is NOT evicted from the map. This method is suitable for calling by methods that return an old * version of an entry being modified (put, replace, remove) - these methods should not return an old expired entry. * * @param entry A possibly null, possibly expired entry * @return A possibly null, never expired entry */ private TimestampedValue<V> filterExpired(final TimestampedValue<V> entry) { if (entry != null && entry.isExpired(getTime(), config)) { return null; } else { return entry; } }
/** * Take an entry (which may be null) and return that entry only if not expired. If expired, return a null. If the * entry is expired, it is NOT evicted from the map. This method is suitable for calling by methods that return an old * version of an entry being modified (put, replace, remove) - these methods should not return an old expired entry. * * @param entry A possibly null, possibly expired entry * @return A possibly null, never expired entry */ private TimestampedValue<V> filterExpired(final TimestampedValue<V> entry) { if (entry != null && entry.isExpired(getTime(), config)) { return null; } else { return entry; } }
/** * Take an entry (which may be null) and return that entry only if not expired. If expired, return a null. If the * entry is expired, it is NOT evicted from the map. This method is suitable for calling by methods that return an old * version of an entry being modified (put, replace, remove) - these methods should not return an old expired entry. * * @param entry A possibly null, possibly expired entry * @return A possibly null, never expired entry */ private TimestampedValue<V> filterExpired(final TimestampedValue<V> entry) { if (entry != null && entry.isExpired(getTime(), config)) { return null; } else { return entry; } }
/** * Take an entry (which may be null) and return that entry only if not expired. If expired, return a null. If the * entry is expired, it is NOT evicted from the map. This method is suitable for calling by methods that return an old * version of an entry being modified (put, replace, remove) - these methods should not return an old expired entry. * * @param entry A possibly null, possibly expired entry * @return A possibly null, never expired entry */ private TimestampedValue<V> filterExpired(final TimestampedValue<V> entry) { if (entry != null && entry.isExpired(getTime(), config)) { return null; } else { return entry; } }
private V getValueSafe(final TimestampedValue<V> entry) { return entry == null ? null : entry.isExpired(getTime(), config) ? null : entry.getValue(); }
private V getValueSafe(final TimestampedValue<V> entry) { return entry == null ? null : entry.isExpired(getTime(), config) ? null : entry.getValue(); }
private V getValueSafe(final TimestampedValue<V> entry) { return entry == null ? null : entry.isExpired(getTime(), config) ? null : entry.getValue(); }
private V getValueSafe(final TimestampedValue<V> entry) { return entry == null ? null : entry.isExpired(getTime(), config) ? null : entry.getValue(); }
private void invalidateCacheEntries() { int totalCnt = 0; int evaled = 0; Iterator<Entry<K, TimestampedValue<V>>> entryIter = data.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<K, TimestampedValue<V>> entry = entryIter.next(); TimestampedValue tsEntry = entry.getValue(); if (tsEntry == null) continue; totalCnt++; if (tsEntry.isExpired(getTime(), config)) { evaled++; entryIter.remove(); } } if (isStatisticsEnabled()) { statistics.increment(totalCnt, evaled); } }
private void invalidateCacheEntries() { int totalCnt = 0; int evaled = 0; Iterator<Entry<K, TimestampedValue<V>>> entryIter = data.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<K, TimestampedValue<V>> entry = entryIter.next(); TimestampedValue tsEntry = entry.getValue(); if (tsEntry == null) continue; totalCnt++; if (tsEntry.isExpired(getTime(), config)) { evaled++; entryIter.remove(); } } if (isStatisticsEnabled()) { statistics.increment(totalCnt, evaled); } }
private void invalidateCacheEntries() { int totalCnt = 0; int evaled = 0; int notEvaled = 0; int errors = 0; Iterator<Entry<K, TimestampedValue<V>>> entryIter = data.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<K, TimestampedValue<V>> entry = entryIter.next(); try { TimestampedValue tsEntry = entry.getValue(); if (tsEntry == null) continue; totalCnt++; if (tsEntry.isExpired(getTime(), config)) { evaled++; entryIter.remove(); } else { notEvaled++; } } catch (Throwable t) { errors++; } } if (isStatisticsEnabled()) { statistics.increment(totalCnt, evaled); } }
private void invalidateCacheEntries() { int totalCnt = 0; int evaled = 0; int notEvaled = 0; int errors = 0; Iterator<Entry<K, TimestampedValue<V>>> entryIter = data.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<K, TimestampedValue<V>> entry = entryIter.next(); try { TimestampedValue tsEntry = entry.getValue(); if (tsEntry == null) continue; totalCnt++; if (tsEntry.isExpired(getTime(), config)) { evaled++; entryIter.remove(); } else { notEvaled++; } } catch (Throwable t) { errors++; } } if (isStatisticsEnabled()) { statistics.increment(totalCnt, evaled); } }
protected void invalidateCacheEntries(final Iterator<K> keys) { int examined = 0; int evicted = 0; while (keys.hasNext()) { K key = keys.next(); try { TimestampedValue<V> wrappedValue = data.get(key); if (wrappedValue == null) continue; examined++; int now = getTime(); if (wrappedValue.isExpired(now, config)) { evicted++; evict(key, wrappedValue, now); } } catch (Throwable t) { logger.error("Unhandled exception inspecting item for [" + key + "] for expiration", t); } } if (isStatisticsEnabled()) { statistics.increment(examined, evicted); } }
protected void invalidateCacheEntries(final Iterator<K> keys) { int examined = 0; int expired = 0; while (keys.hasNext()) { K key = keys.next(); try { TimestampedValue<V> wrappedValue = data.get(key); if (wrappedValue == null) continue; examined++; int now = getTime(); if (wrappedValue.isExpired(now, config)) { expired++; expire(GetType.COHERENT, key, wrappedValue, now); } } catch (Throwable t) { LOGGER.error("Unhandled exception inspecting item for [" + key + "] for expiration", t); } } if (isStatisticsEnabled()) { statistics.increment(examined, expired); } }
private void checkExpired(final Object key, final boolean markUsed) { TimestampedValue<V> entry = this.data.get(key); if (null == entry) return; if (isEvictionEnabled()) { int now = getTime(); if (entry.isExpired(now, config)) { removeNoReturn(key); } else if (markUsed) { entry.markUsed(now, null, config); } } }
protected void invalidateCacheEntries(final Iterator<K> keys) { int examined = 0; int evicted = 0; while (keys.hasNext()) { K key = keys.next(); try { TimestampedValue<V> wrappedValue = data.get(key); if (wrappedValue == null) continue; examined++; int now = getTime(); if (wrappedValue.isExpired(now, config)) { evicted++; evict(key, wrappedValue, now); } } catch (Throwable t) { LOGGER.error("Unhandled exception inspecting item for [" + key + "] for expiration", t); } } if (isStatisticsEnabled()) { statistics.increment(examined, evicted); } }
private void checkExpired(final Object key, final boolean markUsed) { TimestampedValue<V> entry = this.data.get(key); if (null == entry) return; if (isEvictionEnabled()) { int now = getTime(); if (entry.isExpired(now, config)) { removeNoReturn(key); } else if (markUsed) { entry.markUsed(now, null, config); } } }
private void checkExpired(final Object key, final boolean markUsed) { TimestampedValue<V> entry = this.data.get(key); if (null == entry) return; if (isEvictionEnabled()) { int now = getTime(); if (entry.isExpired(now, config)) { removeNoReturn(key); } else if (markUsed) { entry.markUsed(now, null, config); } } }
private void checkExpired(final Object key, final boolean markUsed) { TimestampedValue<V> entry = this.data.get(key); if (null == entry) return; if (isEvictionEnabled()) { int now = getTime(); if (entry.isExpired(now, config)) { removeNoReturn(key); } else if (markUsed) { entry.markUsed(now, "", config); } } }
protected void invalidateCacheEntries(final Iterator<K> keys) { int examined = 0; int expired = 0; while (keys.hasNext()) { K key = keys.next(); try { TimestampedValue<V> wrappedValue = data.get(key); if (wrappedValue == null) continue; examined++; int now = getTime(); if (wrappedValue.isExpired(now, config)) { expired++; expire(GetType.COHERENT, key, wrappedValue, now); } } catch (Throwable t) { LOGGER.error("Unhandled exception inspecting item for [" + key + "] for expiration", t); } } if (config.isLoggingEnabled()) { LOGGER.info("Invalidated cache entries - examined: " + examined + ", expired: " + expired); } if (isStatisticsEnabled()) { statistics.increment(examined, expired); } }