Example usage for android.support.v4.util LruCache remove

List of usage examples for android.support.v4.util LruCache remove

Introduction

In this page you can find the example usage for android.support.v4.util LruCache remove.

Prototype

public final V remove(K key) 

Source Link

Document

Removes the entry for key if it exists.

Usage

From source file:org.schabi.newpipe.util.InfoCache.java

private static Info getInfo(@NonNull final LruCache<String, CacheData> cache, @NonNull final String key) {
    final CacheData data = cache.get(key);
    if (data == null)
        return null;

    if (data.isExpired()) {
        cache.remove(key);
        return null;
    }/*from w  ww  .j  a  va2 s  .  c o  m*/

    return data.info;
}

From source file:org.schabi.newpipe.util.InfoCache.java

private static void removeStaleCache(@NonNull final LruCache<String, CacheData> cache) {
    for (Map.Entry<String, CacheData> entry : cache.snapshot().entrySet()) {
        final CacheData data = entry.getValue();
        if (data != null && data.isExpired()) {
            cache.remove(entry.getKey());
        }/*from w  w w. ja v a 2  s  .  c  o m*/
    }
}