lib/cache.js
function update_db(p, stats, _cb) {
        var key = sprintf(FILES_KEY_FMT, p);
        var k1 = sprintf(FHANDLE_KEY_FMT, p);
        var k2 = sprintf(FNAME_KEY_FMT, stats._fhandle);

        self.db.batch()
            .put(key, stats)
            .put(k1, stats._fhandle)
            .put(k2, p)
            .write(function onBatchWrite(err2) {
                if (err2) {
                    log.error(err2, 'update_db(%s): failed', p);
                    _cb(errno(err2));
                } else {
                    log.trace('update_db(%s): done', p);
                    self.cache.set(key, stats);
                    _cb(null);
                }
            });
    }
function update_db(p, stats, _cb) {
        var key = sprintf(FILES_KEY_FMT, p);
        var k1 = sprintf(FHANDLE_KEY_FMT, p);
        var k2 = sprintf(FNAME_KEY_FMT, stats._fhandle);

        self.db.batch()
            .put(key, stats)
            .put(k1, stats._fhandle)
            .put(k2, p)
            .write(function onBatchWrite(err2) {
                if (err2) {
                    log.error(err2, 'update_db(%s): failed', p);
                    _cb(errno(err2));
                } else {
                    log.trace('update_db(%s): done', p);
                    self.cache.set(key, stats);
                    _cb(null);
                }
            });
    }
function update_db ( p , stats , _cb ) { var key = sprintf ( FILES_KEY_FMT , p ) ; var k1 = sprintf ( FHANDLE_KEY_FMT , p ) ; var k2 = sprintf ( FNAME_KEY_FMT , stats . _fhandle ) ; self . db . batch ( ) . put ( key , stats ) . put ( k1 , stats . _fhandle ) . put ( k2 , p ) . write ( function onBatchWrite ( err2 ) { if ( err2 ) { log . error ( err2 , 'update_db(%s): failed' , p ) ; _cb ( errno ( err2 ) ) ; } else { log . trace ( 'update_db(%s): done' , p ) ; self . cache . set ( key , stats ) ; _cb ( null ) ; } } ) ; }
We can't use self.put here since we need to force the use of the old _fhandle and _cachefile; update the db directly.
We can t use self . put here since we need to force the use of the old _fhandle and _cachefile ; update the db directly .