<commit_before>package com.algolia.search.saas;

import android.util.LruCache;
import android.util.Pair;

import java.util.concurrent.TimeUnit;

/**
 * A cache that holds strong references to a limited number of values for a limited time.
 */
public class ExpiringCache<K, V> {
    public static final TimeUnit expirationTimeUnit = TimeUnit.SECONDS;
    public static final int defaultExpirationTimeout = 2;
    public static final int defaultMaxSize = 64;
    public final int expirationTimeout; // Time after which a cache entry is invalidated

    private final LruCache<K, Pair<V, Long>> lruCache;

    public ExpiringCache(final int timeout, final int maxSize) {
        lruCache = new LruCache<>(maxSize);
        expirationTimeout = timeout;
    }

    public ExpiringCache() {
        this(defaultExpirationTimeout, defaultMaxSize);
    }


    /**
     * Puts a value in the cache, computing an expiration time
     *
     * @return the previous value for this key, if any
     */<commit_msg>App: Using AppCompat's LRUCache for compatibility < API12<commit_after>package com.algolia.search.saas;

import android.support.v4.util.LruCache;
import android.util.Pair;

import java.util.concurrent.TimeUnit;

/**
 * A cache that holds strong references to a limited number of values for a limited time.
 */
public class ExpiringCache<K, V> {
    public static final TimeUnit expirationTimeUnit = TimeUnit.SECONDS;
    public static final int defaultExpirationTimeout = 2;
    public static final int defaultMaxSize = 64;
    public final int expirationTimeout; // Time after which a cache entry is invalidated

    private final LruCache<K, Pair<V, Long>> lruCache;

    public ExpiringCache(final int timeout, final int maxSize) {
        lruCache = new LruCache<>(maxSize);
        expirationTimeout = timeout;
    }

    public ExpiringCache() {
        this(defaultExpirationTimeout, defaultMaxSize);
    }


    /**
     * Puts a value in the cache, computing an expiration time
     *
     * @return the previous value for this key, if any
     */
{'fraction_non_alphanumeric': 0.07729703451628585, 'fraction_numerical': 0.004375303840544483, 'mean_word_length': 3.3974358974358974, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '983032', 'n_tokens_mistral': 588, 'n_tokens_neox': 562, 'n_words': 204}