diff --git a/lib/cartodb/cache_validator.js b/lib/cartodb/cache_validator.js deleted file mode 100644 index 4b3f2181..00000000 --- a/lib/cartodb/cache_validator.js +++ /dev/null @@ -1,25 +0,0 @@ -var Varnish = require('node-varnish'); -var varnish_queue = null; - -function init(host, port, secret) { - varnish_queue = new Varnish.VarnishQueue(host, port, secret); - varnish_queue.on('error', function(e) { - console.log("[CACHE VALIDATOR ERROR] " + e); - }); -} - -function invalidate_db(dbname, table) { - var cmd = 'purge obj.http.X-Cache-Channel ~ "^' + dbname + - ':(.*'+ table +'.*)|(table)$"'; - try{ - varnish_queue.run_cmd(cmd, false); - } catch (e) { - console.log("[CACHE VALIDATOR ERROR] could not queue command " + - cmd + " -- " + e); - } -} - -module.exports = { - init: init, - invalidate_db: invalidate_db -}; diff --git a/package.json b/package.json index 64618960..23cf68e2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "Sandro Santilli " ], "dependencies": { - "node-varnish": "https://github.com/Vizzuality/node-varnish/tarball/0.3.0", "underscore" : "~1.6.0", "dot": "~1.0.2", "windshaft": "https://github.com/CartoDB/Windshaft/tarball/master", diff --git a/test/acceptance/cache_validator.js b/test/acceptance/cache_validator.js deleted file mode 100644 index 79939740..00000000 --- a/test/acceptance/cache_validator.js +++ /dev/null @@ -1,21 +0,0 @@ -var assert = require('../support/assert'); -require(__dirname + '/../support/test_helper'); -var CacheValidator = require(__dirname + '/../../lib/cartodb/cache_validator'); - -var VarnishEmu = require('../support/VarnishEmu'); - -suite('cache_validator', function() { - - test('should call purge on varnish when invalidate database', function(done) { - var varnish = new VarnishEmu(function(cmds) { - assert.ok(cmds.length == 1); - assert.equal('purge obj.http.X-Cache-Channel ~ \"^test_db:(.*test_cache.*)|(table)$\"\n', cmds[0].toString('utf8')); - done(); - }, - function() { - CacheValidator.init('localhost', 1337); - CacheValidator.invalidate_db('test_db', 'test_cache'); - }); - }); - -});