This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed snappy and protobuf from the main library and moved them
into independent modules.
- Loading branch information
1 parent
8614f69
commit 148fee8
Showing
11 changed files
with
118 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var speedy = require('speedy'); | ||
|
||
var RequestHttpCache = require('../..'); | ||
var request = require('request'); | ||
|
||
var httpRequestCache = new RequestHttpCache({ | ||
backend: 'redis', | ||
compressor: require('request-http-cache-snappy-compressor'), | ||
redisPrefix: 'hc:' + Date.now() + ":" | ||
}); | ||
|
||
|
||
function makeRequest(token, callback) { | ||
httpRequestCache.extension({ | ||
method: 'GET', | ||
url: 'https://api.github.com/user/repos?per_page=100', | ||
headers: { | ||
Authorization: 'token ' + token, | ||
'User-Agent': 'request-http-cache-test/1.0', | ||
}, | ||
json: true | ||
}, callback, request); | ||
} | ||
|
||
makeRequest(process.env.GITHUB_TOKEN_1, function() { | ||
setTimeout(function() { | ||
speedy.run(function(done) { | ||
makeRequest(process.env.GITHUB_TOKEN_1, done); | ||
}); | ||
}, 500); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var speedy = require('speedy'); | ||
|
||
var RequestHttpCache = require('../..'); | ||
var request = require('request'); | ||
|
||
var httpRequestCache = new RequestHttpCache({ | ||
backend: 'redis', | ||
serializer: require('request-http-cache-protobuf-serializer'), | ||
compressor: require('request-http-cache-snappy-compressor'), | ||
redisPrefix: 'hc:' + Date.now() + ":" | ||
}); | ||
|
||
|
||
function makeRequest(token, callback) { | ||
httpRequestCache.extension({ | ||
method: 'GET', | ||
url: 'https://api.github.com/user/repos?per_page=100', | ||
headers: { | ||
Authorization: 'token ' + token, | ||
'User-Agent': 'request-http-cache-test/1.0', | ||
}, | ||
json: true | ||
}, callback, request); | ||
} | ||
|
||
makeRequest(process.env.GITHUB_TOKEN_1, function() { | ||
setTimeout(function() { | ||
speedy.run(function(done) { | ||
makeRequest(process.env.GITHUB_TOKEN_1, done); | ||
}); | ||
}, 500); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var speedy = require('speedy'); | ||
|
||
var RequestHttpCache = require('../..'); | ||
var request = require('request'); | ||
|
||
var httpRequestCache = new RequestHttpCache({ | ||
backend: 'redis', | ||
serializer: require('request-http-cache-protobuf-serializer'), | ||
redisPrefix: 'hc:' + Date.now() + ":" | ||
}); | ||
|
||
|
||
function makeRequest(token, callback) { | ||
httpRequestCache.extension({ | ||
method: 'GET', | ||
url: 'https://api.github.com/user/repos?per_page=100', | ||
headers: { | ||
Authorization: 'token ' + token, | ||
'User-Agent': 'request-http-cache-test/1.0', | ||
}, | ||
json: true | ||
}, callback, request); | ||
} | ||
|
||
makeRequest(process.env.GITHUB_TOKEN_1, function() { | ||
setTimeout(function() { | ||
speedy.run(function(done) { | ||
makeRequest(process.env.GITHUB_TOKEN_1, done); | ||
}); | ||
}, 500); | ||
}); |