Skip to content

Commit

Permalink
Avoid orphaned cache files from breaking the caching layer.
Browse files Browse the repository at this point in the history
  • Loading branch information
cweider committed Mar 4, 2012
1 parent 6fd73ec commit 57d0a2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion node/utils/caching_middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CachingMiddleware.prototype = new function () {
var modifiedSince = (req.headers['if-modified-since']
&& new Date(req.headers['if-modified-since']));
var lastModifiedCache = !error && stats.mtime;
if (lastModifiedCache) {
if (lastModifiedCache && responseCache[cacheKey]) {
req.headers['if-modified-since'] = lastModifiedCache.toUTCString();
} else {
delete req.headers['if-modified-since'];
Expand Down

0 comments on commit 57d0a2e

Please sign in to comment.