Code example for AtomicLong

    private boolean isTrimPending;
    private final Object lock;
    private AtomicLong lastClearCacheTime = new AtomicLong(0);
    // The value of tag should be a final String that works as a directory name. 
    public FileLruCache(Context context, String tag, Limits limits) {
        this.tag = tag;
        this.limits = limits; = new File(context.getCacheDir(), tag);
        this.lock = new Object();
        // Ensure the cache dir exists 
        if ( || {
            // Remove any stale partially-written files from a previous run 
    // This is not robust to files changing dynamically underneath it and should therefore only be used 
    // for test code.  If we ever need this for product code we need to think through synchronization. 
Connect your IDE to all the code out there  Get Codota for Java