lib/cache.js
function process_entry(val, nextent) {
        if (!val || !val._tmp_pathname) {
            // if this is somehow missing, just skip it since we can't check
            // to see if the file is dirty
            nextent();
            return;
        }

        var nm = val._tmp_pathname;
        delete val._tmp_pathname;
        // if in-use or dirty, skip it
        if (val._no_evict || val._in_flight || wb_pending[nm] ||
          wb_inprogress[nm]) {
            nextent();
            return;
        }


        // if we've gotten under the limit, skip over the rest of the objects
        if (self.curr_size < self.max_size) {
            nextent();
            return;
        }

        fs.stat(val._cacheFile, function (serr, stats) {
            if (serr) {
                // just assume an error is ENOENT meaning object is not cached
                // this is common
                nextent();
                return;
            }

            // recheck after callback if in-use or dirty and skip it
            if (val._no_evict || val._in_flight || wb_pending[nm] ||
              wb_inprogress[nm]) {
                nextent();
                return;
            }

            fs.unlink(val._cacheFile, function (uerr) {
                // ignore errors deleting the cachefile but if no
                // error, that means we should adjust our size
                if (!uerr) {
                    self._reduce_cache(nm, stats.size);
                    log.trace('evicted(%s, %d): %d', nm, size, self.curr_size);
                }

                nextent();
            });
        });
    }
function process_entry(val, nextent) {
        if (!val || !val._tmp_pathname) {
            // if this is somehow missing, just skip it since we can't check
            // to see if the file is dirty
            nextent();
            return;
        }

        var nm = val._tmp_pathname;
        delete val._tmp_pathname;
        // if in-use or dirty, skip it
        if (val._no_evict || val._in_flight || wb_pending[nm] ||
          wb_inprogress[nm]) {
            nextent();
            return;
        }


        // if we've gotten under the limit, skip over the rest of the objects
        if (self.curr_size < self.max_size) {
            nextent();
            return;
        }

        fs.stat(val._cacheFile, function (serr, stats) {
            if (serr) {
                // just assume an error is ENOENT meaning object is not cached
                // this is common
                nextent();
                return;
            }

            // recheck after callback if in-use or dirty and skip it
            if (val._no_evict || val._in_flight || wb_pending[nm] ||
              wb_inprogress[nm]) {
                nextent();
                return;
            }

            fs.unlink(val._cacheFile, function (uerr) {
                // ignore errors deleting the cachefile but if no
                // error, that means we should adjust our size
                if (!uerr) {
                    self._reduce_cache(nm, stats.size);
                    log.trace('evicted(%s, %d): %d', nm, size, self.curr_size);
                }

                nextent();
            });
        });
    }
See if we have the object cached and try to evict it