From 140e4419192854339795e2d084c0d31243fa8f86 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 8 Jun 2013 16:17:42 -0700 Subject: [PATCH] rename fetchTTL to ttl --- bin/kwikemon | 2 +- kwikemon.js | 4 ++-- test.js | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/kwikemon b/bin/kwikemon index e978fae..2bc7600 100755 --- a/bin/kwikemon +++ b/bin/kwikemon @@ -87,7 +87,7 @@ if (opt && opt[0] == '-') { case '-t': case '--ttl': var name = process.argv[3]; - kwikemon.fetchTTL(name, function(err, ttl) { + kwikemon.ttl(name, function(err, ttl) { if (typeof ttl == 'number') { console.log(ttl); process.exit(0); diff --git a/kwikemon.js b/kwikemon.js index 8488fc5..b75b6f3 100644 --- a/kwikemon.js +++ b/kwikemon.js @@ -9,7 +9,7 @@ module.exports = { // read , exists: callbackOptional(exists) , fetch: callbackOptional(fetch) -, fetchTTL: callbackOptional(fetchTTL) +, ttl: callbackOptional(ttl) , list: list , fetchAll: fetchAll , count: count @@ -122,7 +122,7 @@ function fetch(name, cb) { redis.hgetall(k(name), cb); } -function fetchTTL(name, cb) { +function ttl(name, cb) { redis.ttl(k(name), cb); } diff --git a/test.js b/test.js index fd502af..aaa0086 100755 --- a/test.js +++ b/test.js @@ -37,7 +37,7 @@ describe("kwikemon", function() { it("should set custom ttls", function(done) { kwikemon.set('foo', 'bar', { ttl: 1 }, function(err) { - kwikemon.fetchTTL('foo', function(err, ttl) { + kwikemon.ttl('foo', function(err, ttl) { assert(ttl <= 1); done(); }); @@ -46,7 +46,7 @@ describe("kwikemon", function() { it("should not expire with a ttl of zero", function(done) { kwikemon.set('foo', 'bar', { ttl: 0 }, function(err) { - kwikemon.fetchTTL('foo', function(err, ttl) { + kwikemon.ttl('foo', function(err, ttl) { assert(ttl == -1); done(); }); @@ -55,7 +55,7 @@ describe("kwikemon", function() { it("should not expire when ttl is < 0", function(done) { kwikemon.set('foo', 'bar', { ttl: -1 }, function(err) { - kwikemon.fetchTTL('foo', function(err, ttl) { + kwikemon.ttl('foo', function(err, ttl) { assert(ttl == -1); done(); }); @@ -115,10 +115,10 @@ describe("kwikemon", function() { }); }); - describe("#fetchTTL", function() { + describe("#ttl", function() { it("should fetch the last TTL set", function(done) { kwikemon.set('foo', 'bar', { ttl: 300 }, function(err) { - kwikemon.fetchTTL('foo', function(err, ttl) { + kwikemon.ttl('foo', function(err, ttl) { assert(ttl <= 300); done(); }); @@ -126,7 +126,7 @@ describe("kwikemon", function() { }); it("should return -1 for non-existent monitors", function(done) { - kwikemon.fetchTTL('non-existent', function(err, ttl) { + kwikemon.ttl('non-existent', function(err, ttl) { assert(ttl == -1); done(); });