added X-Cache-Channel header so the tile cache could be invalidated using that key

for the moment we're using the database name as 
cache key, it is not the best solution because all
the tiles for that database will be invalidated 
when a change is done in any table. Doing this we
avoid getting wrong data when user gets tiles which
come from a query with joins.
This commit is contained in:
javi
2011-11-29 21:19:10 +01:00
parent f524d6914e
commit cb69faffc0

View File

@@ -16,12 +16,18 @@ var CartodbWindshaft = function(serverOptions) {
afterTileRender: lru_cache.afterTileRender,
cacheStats: lru_cache.getStats,
afterStateChange: lru_cache.afterStateChange
})
});
}
// set the cache chanel info to invalidate the cache on the frontend server
serverOptions.afterTileRender = function(req, res, tile, headers, callback) {
res.header('X-Cache-Channel', req.params.dbname);
callback(null, tile, headers);
};
// boot
var ws = new Windshaft.Server(serverOptions);
/**
* Helper to allow access to the layer to be used in the maps infowindow popup.
*/