Windshaft-cartodb/lib/cartodb/cache_validator.js

18 lines
379 B
JavaScript
Raw Normal View History

var _ = require('underscore'),
Varnish = require('node-varnish');
2011-12-01 02:59:28 +08:00
var varnish_queue = null;
2011-12-01 02:59:28 +08:00
function init(host, port) {
varnish_queue = new Varnish.VarnishQueue(host, port);
}
2011-12-01 02:59:28 +08:00
function invalidate_db(dbname) {
varnish_queue.run_cmd('purge obj.http.X-Cache-Channel == ' + dbname);
}
2011-12-01 02:59:28 +08:00
module.exports = {
init: init,
invalidate_db: invalidate_db
}