Revert "Remove caching, creates more problems than it solves"

This reverts commit a4b9427896.
This commit is contained in:
Peter 'Pita' Martischka 2011-06-30 12:40:37 +01:00
parent 5c7d96b469
commit 946568d3a3
2 changed files with 9 additions and 7 deletions

View File

@ -225,7 +225,7 @@ exports.padJS = function(req, res)
pathStr = path.normalize(__dirname + "/../var/minified_pad.js");
}
res.sendfile(pathStr);
res.sendfile(pathStr, { maxAge: server.maxAge });
})
}
//minifying is disabled, so load the files with jquery

View File

@ -32,6 +32,8 @@ var path = require('path');
var minify = require('./minify');
var serverName = "Etherpad-Lite ( http://j.mp/ep-lite )";
//cache a week
exports.maxAge = 1000*60*60*24*1;
async.waterfall([
//initalize the database
@ -54,7 +56,7 @@ async.waterfall([
{
res.header("Server", serverName);
var filePath = path.normalize(__dirname + "/.." + req.url.split("?")[0]);
res.sendfile(filePath);
res.sendfile(filePath, { maxAge: exports.maxAge });
});
//serve minified files
@ -86,7 +88,7 @@ async.waterfall([
res.header("Server", serverName);
var filePath = path.normalize(__dirname + "/../static/pad.html");
res.sendfile(filePath);
res.sendfile(filePath, { maxAge: exports.maxAge });
});
//serve timeslider.html under /p/$padname/timeslider
@ -101,7 +103,7 @@ async.waterfall([
res.header("Server", serverName);
var filePath = path.normalize(__dirname + "/../static/timeslider.html");
res.sendfile(filePath);
res.sendfile(filePath, { maxAge: exports.maxAge });
});
//serve index.html under /
@ -109,7 +111,7 @@ async.waterfall([
{
res.header("Server", serverName);
var filePath = path.normalize(__dirname + "/../static/index.html");
res.sendfile(filePath);
res.sendfile(filePath, { maxAge: exports.maxAge });
});
//serve robots.txt
@ -117,7 +119,7 @@ async.waterfall([
{
res.header("Server", serverName);
var filePath = path.normalize(__dirname + "/../static/robots.txt");
res.sendfile(filePath);
res.sendfile(filePath, { maxAge: exports.maxAge });
});
//serve favicon.ico
@ -125,7 +127,7 @@ async.waterfall([
{
res.header("Server", serverName);
var filePath = path.normalize(__dirname + "/../static/favicon.ico");
res.sendfile(filePath);
res.sendfile(filePath, { maxAge: exports.maxAge });
});
//let the server listen