Skip to content

Commit

Permalink
Updating to latest cache-service.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Lokahi Podwys committed Apr 20, 2015
1 parent 1c150eb commit e09a92f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = function(superagent, config){
var _this = this;
var key = keygen(this, curProps);
if(this.method === 'GET'){
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
if(!err && response){
cb(err, response, key);
}
Expand All @@ -82,7 +82,7 @@ module.exports = function(superagent, config){
response = response[curProps.responseProp] || null;
}
if(!isEmpty(response) || curProps.cacheWhenEmpty){
superagent.cacheService.setKey(key, response, curProps.expiration, function(){
superagent.cacheService.set(key, response, curProps.expiration, function(){
cb(err, response, key);
});
}
Expand All @@ -101,7 +101,7 @@ module.exports = function(superagent, config){
else{
this._end(function (err, response){
if(!err && response){
superagent.cacheService.deleteKeys(key, function (){
superagent.cacheService.del(key, function (){
cb(err, response, key);
});
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "superagent-cache",
"version": "0.1.3",
"version": "0.1.4",
"description": "Superagent with tiered caching provided by cache-service.",
"main": "index.js",
"dependencies": {
"superagent": "1.1.0",
"cache-service": "0.1.0"
"cache-service": "0.1.3"
},
"devDependencies": {
"mocha": "1.13.0",
Expand Down
20 changes: 10 additions & 10 deletions test/server/superagent-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Custom API items to test:
describe('Array', function(){

beforeEach(function(){
superagent.cacheService.flushKeys();
superagent.cacheService.flush();
});

describe('superagentCache API tests', function () {
Expand Down Expand Up @@ -101,11 +101,11 @@ describe('Array', function(){
.expiration(0.001)
.end(function (err, response, key){
expect(response.body.key).toBe('one');
superagent.cacheService.getKey(key, function (err, result){
superagent.cacheService.get(key, function (err, result){
expect(result.body.key).toBe('one');
});
setTimeout(function(){
superagent.cacheService.getKey(key, function (err, result){
superagent.cacheService.get(key, function (err, result){
expect(result).toBe(null);
done();
});
Expand All @@ -123,7 +123,7 @@ describe('Array', function(){
.prune(prune)
.end(function (err, response, key){
expect(response).toBe(false);
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response).toBe(false);
done();
});
Expand All @@ -141,7 +141,7 @@ describe('Array', function(){
.cacheWhenEmpty(false)
.end(function (err, response, key){
expect(response).toBe(false);
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response).toBe(null);
done();
});
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('Array', function(){
.get('localhost:3000/one')
.end(function (err, response, key){
expect(response.body.key).toBe('one');
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response.body.key).toBe('one');
done();
});
Expand All @@ -238,14 +238,14 @@ describe('Array', function(){
.get('localhost:3000/one')
.end(function (err, response, key){
expect(response.body.key).toBe('one');
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response.body.key).toBe('one');
superagent
.put('localhost:3000/one')
.end(function (err, response, key){
expect(typeof key).toBe('string');
expect(response.body.key).toBe('put');
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response).toBe(null);
done();
});
Expand All @@ -261,14 +261,14 @@ describe('Array', function(){
.get('localhost:3000/one')
.end(function (err, response, key){
expect(response.body.key).toBe('one');
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response.body.key).toBe('one');
superagent
.put('localhost:3000/one')
.end(function (err, response, key){
expect(typeof key).toBe('string');
expect(response.body.key).toBe('put');
superagent.cacheService.getKey(key, function (err, response){
superagent.cacheService.get(key, function (err, response){
expect(response).toBe(null);
done();
});
Expand Down

0 comments on commit e09a92f

Please sign in to comment.