Skip to content

Commit 2770f95

Browse files
renamed computeTtl() to ttl()
1 parent 09004fd commit 2770f95

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/caching.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ var caching = function(args) {
113113
return;
114114
}
115115

116-
if (options && typeof options.computeTtl === 'function') {
117-
options.ttl = options.computeTtl(data);
118-
delete options.computeTtl;
116+
if (options && typeof options.ttl === 'function') {
117+
options.ttl = options.ttl(data);
119118
}
120119

121120
self.store.set(key, data, options, function(err) {

test/caching.unit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ describe("caching", function() {
360360
});
361361
});
362362

363-
context("compute ttl", function() {
363+
context("ttl function", function() {
364364
beforeEach(function() {
365365
sinon.spy(memoryStoreStub, 'set');
366366
});
@@ -369,9 +369,9 @@ describe("caching", function() {
369369
memoryStoreStub.set.restore();
370370
});
371371

372-
it("when a computeTtl function is passed in", function(done) {
372+
it("when a ttl function is passed in", function(done) {
373373
opts = {
374-
computeTtl: function(widget) {
374+
ttl: function(widget) {
375375
assert.deepEqual(widget, {name: name});
376376
return 0.2;
377377
}

0 commit comments

Comments
 (0)