Vousiu
Source: Http://www.cnblogs.com/vousiu
This example refers to the book "node. js in action" from Mike Cantelon and others.
Server.js
As I said earlier, I think the cache here can not be passed in as a parameter. It is not affected here because it is a pass-through reference. However, if a parameter is passed, the value of the cache is not up-to-date because the first function in the async queue is not running when the next asynchronous function joins the asynchronous queue, and when it runs the cache value is changed, and then the parameter value of the asynchronous function is still the old value, which will result in redundant read hard disk.
Finally put the contents of the Package.json:
{ "name": "Chatroom", "version": "0.0.1", "description": "Chat server", "Dependencies": { "Socket.io": "~0.9.6", "MIME": "~1.2.7" }}
Node Chat program Instance 06:server.js