title: How module.export caching works in node
body: <p>I have read everywhere that module.exports is cached and returns the same object everytime required is called after first call.
  Here is my code-<br>index.js<br></p>
  
  <pre><code>var http= require('http');    
  var Customer= require('./code/Customer');
  var Wishlist= require('./code/Wishlist');
  
  var server= http.createServer(function(req,res){
  
  console.log("Request received");
  
  
  res.end("Request received");
  
  
  });
  
  server.listen(3000,function(){
  
      console.log("hello");
  
      });
  </code></pre>
  
  <p>customer.js</p>
  
  <pre><code>var emitter= require('../../lib/EventDispatcher')();
  emitter.on('wishlist',function(){
  
  console.log("Listened to wishlist event");
  
  });
  
  module.exports= function(){
  
  console.log("Inside customer");
  }
  </code></pre>
  
  <p>Wishlist.js</p>
  
  <pre><code>var emitter= require('../../lib/EventDispatcher')();
  
  module.exports= function(){
  
  console.log("Inside customer");
  emitter.emit('wishlist');
  }
  </code></pre>
  
  <p>EventDispatcher.js</p>
  
  <pre><code>var emitter= require('events').EventEmitter;
  
  module.exports= function() {
  
  console.log("created"); 
  return new emitter();
  }
  </code></pre>
  
  <p>If my eventDispatcher is cached then event emitted by wishlist should be catched by customer. But its not happening.</p>
  
  <p>I am trying to create a backbone for observers so that every module can listen for events on their own.Is it the correct way to do it?</p>