included LRU cache with redis invalidation

This commit is contained in:
javi santana
2011-10-13 13:17:00 +02:00
parent a211d3c296
commit c1ba45cf5a
10 changed files with 682 additions and 48 deletions
+24
View File
@@ -0,0 +1,24 @@
var assert = require('assert'),
tests = module.exports = {},
th = require(__dirname + '/../test_helper'),
CacheValidator = require(__dirname + '/../../lib/cartodb/cache_validator')
var cache = CacheValidator(global.environment.redis);
tests["should get the timestamp it sets"] = function() {
var d = new Date().getTime();
cache.setTimestamp('mydatabase', 'mytable', d, function() {
cache.getTimestamp('mydatabase', 'mytable', function(err, t) {
assert.eql(t, d);
})
});
}
tests["should get null when timestamp is not set"] = function() {
var d = new Date().getTime();
cache.getTimestamp('mydatabase', 'mytable2', function(err, t) {
assert.ok(t === null);
})
}