nl_tokens: Fetch the resource and call done when it is fetched
pl_tokens: function done ( err , resource ) { totalRequestElapsed += ( ( new Date ( ) . getTime ( ) ) - started ) ; ++ totalRequests ; stats . avgFetchTime = parseInt ( totalRequestElapsed / totalRequests ) ; if ( <mask> || verbose ) util . log ( 'cache|execute|done|err=' + err + '|result=' + ( resource ? 'found' : 'null' ) ) ; if ( err ) { ++ stats . failed ; } if ( ! err && defaultCacheTTL ) { // ttl ===  0 --> expire imediatly. if ( stats . inCache >= defaultCacheSize ) { weedOutCache ( ) ; } var now = new Date ( ) . getTime ( ) ; resourceCache [ key ] = { 'key' : key , 'epoch' : now , 'access' : now , 'expire' : defaultCacheTTL , 'hits' : 0 , 'data' : resource } ; ++ stats . inCache ; } var pendingRequests = requestQueue [ key ] ; delete requestQueue [ key ] ; for ( var i = 0 , size = pendingRequests . length ; i < size ; ++ i ) { if ( debug ) util . log ( 'cache|calling=' + i + '|err=' + err + '|resource=' + ( resource ? 'found' : 'null' ) ) ; if ( ! err && defaultCacheTTL ) { ++ resourceCache [ key ] . hits ; } pendingRequests [ i ] . call ( this , err , resource , resourceCache [ key ] ) ; -- stats . waiting ; } -- stats . fetching ; if ( stats . fetching === 0 && stats . waiting === 0 ) { self . emit ( 'stats' , stats ) ; } else { bufferedEmitter . call ( self , 'stats' , stats ) ; } }