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