Skip to content

Commit

Permalink
All cache ttl is now in ms
Browse files Browse the repository at this point in the history
  • Loading branch information
mallocator committed Mar 21, 2017
1 parent 5ea5c2f commit 8f345fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class Cache {
this._name = name;
this._type = config.type;
this._ttl = features.ttl && config.ttl;
this._ttl && (this._ttl *= 1000);
this._timeouts = {};
}

Expand Down
4 changes: 2 additions & 2 deletions test/cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Cache', () => {
}

it('should expire an entry after a given time', async () => {
let memory = new Memory({type: 'memory', ttl: 0.05}, 'Test');
let memory = new Memory({type: 'memory', ttl: 50}, 'Test');

await memory.store('TestType', 1, {a: 'Test'});
let result1 = await memory.fetch('TestType', 1);
Expand All @@ -22,7 +22,7 @@ describe('Cache', () => {
});

it('should reset the ttl if stored or fetched again', async () => {
let memory = new Memory({type: 'memory', ttl: 0.05}, 'Test');
let memory = new Memory({type: 'memory', ttl: 50}, 'Test');

await memory.store('TestType', 1, {a: 'Test'});
let result1 = await memory.fetch('TestType', 1);
Expand Down

0 comments on commit 8f345fe

Please sign in to comment.