apigee-cache-promise
v1.0.1
Published
Promisified version of Apigee Access Cache for get, put, and remove.
Downloads
5
Maintainers
Readme
apigee-cache-promise
Wrapper of promisified version of Apigee Access Cache for get, put, and remove. For thorough documentation about Apigee Access. Please check Apigee-Access.
Usage
get
var apigee = require('apigee-access'),
cache = apigee.getCache(),
apigee_cache_promise = require('apigee-cache-promise')(cache);
apigee_cache_promise.get('cache_key')
.then(function(cached_value) {
console.log(cached_value);
return JSON.parse(cached_value);
})
.then(function(cached_value) {
//do more stuff
})
.catch(function(e){
console.log('something failed!');
})
put
apigee_cache_promise.put('cache_key', '{"test": "test_val"}', 300 // 5 minutes)
.then(function() {
console.log('Successfully stored in cache');
})
.then(function(cached_value) {
//do more stuff
})
.catch(function(e) {
console.log('something failed!');
})
remove
apigee_cache_promise.remove('cache_key')
.then(function() {
console.log('Successfully removed from cache');
})
.then(function(cached_value) {
//do more stuff
})
.catch(function(e) {
console.log('something failed!');
})
Contributing
If you would like to contribute, simply fork the repository, push your changes to a branch and send a pull request:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Typo fixes, improvements to grammar or readability, it's all welcome.
License
Copyright (c) 2017 Diego Zuluaga (twitter: @dzuluaga) Licensed under the Apache license Version 2.0.