在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ekristen/node-github-cache开源软件地址:https://github.com/ekristen/node-github-cache开源编程语言:JavaScript 100.0%开源软件介绍:Caching Layer for Node-GitHubThis is a Node.JS module that transparently adds caching for the node-github project. This library makes use of node-libkv for providing a consistent API layer for multiple different key/value storage backends. By default if no Changelog2.2.0Thank you to @jdanyow, he put together the PR and commits to make this possible.
2.0.0
InstallationInstall with Node.JS package manager
DocumentationYou use this class just like you would use node-github. If you want to not use the cache at any time, add Settings
ExampleUsing libkv + redisRedis must be running on the localhost in this example. var GitHubApi = require('github')
var GitHubCache = require('github-cache')
var github_api = new GitHubApi({
version: '3.0.0',
validateCache: true
})
var github = new GitHubCache(github_api, {
cachedb: 'redis://'
})
github.user.getFollowingFromUser({
user: 'ekristen',
cache: false
}, function(err, res) {
console.log(JSON.stringify(res))
})
github.orgs.getTeams({
org: 'private',
validateCache: false
}, function (err, teams) {
console.log(teams)
}) Using consul library directlyvar GitHubCache = require('github-cache')
var consul = require('consul')({
host: '127.0.0.1'
})
// Need to make the set function available as `put` for the cache library to work.
consul.kv.put = consul.kv.set
// You will want to use a prefix and a `/` separator so that they keys get separated out better in consul.
var github_api = new GitHubAPI({
version: '3.0.0'
})
var github = new GitHubCache({
cachedb: consul.kv,
prefix: 'github-cache',
separator: '/'
})
github.authenticate({
type: 'oauth',
token: process.env.GHTOKEN
})
github.user.getFollowingFromUser({
user: 'ekristen',
}, function (err, data) {
console.log(data)
}) Custom CacheDB InstanceYou may pass in your own custom cachedb instance to |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论