@SuppressWarnings("UnnecessaryUnboxing")
    public void cleanUpLifetimeExpired() {
        final long currentTime = currentTimeMillis();
        // Test whether there could be an element that has to be removed
        if (_nearstExpiringTime > 0 && _nearstExpiringTime <= currentTime) {
            // Go through all elements and remove elements that are outdated
            final List<K> keysToRemove = new ArrayList<>();
            synchronized (_lock) {
                _nearstExpiringTime = 0;
                for (final CacheEntry<K, V> cacheEntry : _entries.values()) {
                    final Long expire = cacheEntry.getExpire();
                    if (expire != null) {
                        final long unboxedExpire = expire.longValue();
                        if (unboxedExpire <= currentTime) {
                            keysToRemove.add(cacheEntry.getKey());
                        } else if (_nearstExpiringTime == 0 || unboxedExpire < _nearstExpiringTime) {
                            _nearstExpiringTime = unboxedExpire;
                        }
                    }
                }
                for (final K key : keysToRemove) {
                    removeInternal(key);
                }
            }
        }
    }
@SuppressWarnings("UnnecessaryUnboxing")
    public void cleanUpLifetimeExpired() {
        final long currentTime = currentTimeMillis();
        
        if (_nearstExpiringTime > 0 && _nearstExpiringTime <= currentTime) {
            
            final List<K> keysToRemove = new ArrayList<>();
            synchronized (_lock) {
                _nearstExpiringTime = 0;
                for (final CacheEntry<K, V> cacheEntry : _entries.values()) {
                    final Long expire = cacheEntry.getExpire();
                    if (expire != null) {
                        final long unboxedExpire = expire.longValue();
                        if (unboxedExpire <= currentTime) {
                            keysToRemove.add(cacheEntry.getKey());
                        } else if (_nearstExpiringTime == 0 || unboxedExpire < _nearstExpiringTime) {
                            _nearstExpiringTime = unboxedExpire;
                        }
                    }
                }
                for (final K key : keysToRemove) {
                    removeInternal(key);
                }
            }
        }
    }
@ SuppressWarnings ( "UnnecessaryUnboxing" ) public void cleanUpLifetimeExpired ( ) { final long currentTime = currentTimeMillis ( ) ; // Test whether there could be an element that has to be removed if ( _nearstExpiringTime > 0 && _nearstExpiringTime <= currentTime ) { // Go through all elements and remove elements that are outdated final List < K > keysToRemove = new ArrayList <> ( ) ; synchronized ( _lock ) { _nearstExpiringTime = 0 ; for ( final CacheEntry < K , V > cacheEntry : _entries . values ( ) ) { final Long expire = cacheEntry . getExpire ( ) ; if ( expire != null ) { final long unboxedExpire = expire . longValue ( ) ; if ( unboxedExpire <= currentTime ) { keysToRemove . add ( cacheEntry . getKey ( ) ) ; } else if ( _nearstExpiringTime == 0 || unboxedExpire < _nearstExpiringTime ) { _nearstExpiringTime = unboxedExpire ; } } } for ( final K key : keysToRemove ) { removeInternal ( key ) ; } } } }
Remove entries that are out of their maxLifetime.
Remove entries that are out of their maxLifetime .