I am using Nodejs and Express Js. Also I add NowJS to the Express Js to do some real-time stuffs.
In the configuration file I have
app.configure(\'pr
Express is built on Connect, and Connect provides the "static" middleware. Here's the code under the hood for the caching:
if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (maxAge / 1000));
You can find that code here:
https://github.com/senchalabs/connect/blob/master/lib/middleware/static.js#L147
So as you can see Express is sending a "Cache-Control" header to the browser, telling him to cache that file for a period. So this isn't a "load a file once and then always serve it to all clients", but more of a "tell each client to cache the file the first time he downloads it" (which means all the clients will have to download that file once before it's cached for them).