Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sc5/aws-document-cache
Generic document cache based on DynamoDB
https://github.com/sc5/aws-document-cache
Last synced: 8 days ago
JSON representation
Generic document cache based on DynamoDB
- Host: GitHub
- URL: https://github.com/sc5/aws-document-cache
- Owner: SC5
- License: mit
- Created: 2015-07-21T10:35:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-03T19:47:41.000Z (almost 9 years ago)
- Last Synced: 2024-10-02T09:15:08.298Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 22
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aws-document-cache NPM module
A module for implementing a simple in-memory and DB cache for 3rd party datasources using AWS DynamoDB
## Prerequisites
A DynamoDB table with a primary key "cacheKey" of type "String"
AWS credentials as required by aws-sdk module (e.g. ~/.aws/credentials)## Use example
var cache = require("aws-document-cache");
cache.init({
'awsRegion' : 'eu-west-1', # Region where the table resides
'cacheTable' : 'myDynamoDBTable', # Table for the cache
'memCacheLifetime' : 3600 * 1000, # Lifespan in ms for the memory cache entries
'dbCacheLifetime' : 24 * 3600 * 1000, # Lifespan in ms for the db cache entries
});
cache.getDoc('myObjType', 'myObjId', function(err,data) {
if (err) {
...
}
if (data == null) {
... was not found in cache, load it
}
});cache.setDoc('myObjType', 'myObjId', data, function(err, data) {
if (err) {
... storage failed
}
...
}
## Release History
* 2015/07/21 - v0.0.1 - Initial version of module
* 2015/07/22 - v0.0.2 - BUGFIX: old references to promise style callbacks removed
* 2015/07/22 - v0.0.3 - BUGFIX: old references to promise style callbacks removed
* 2015/12/28 - v0.0.5 - Cleaned temp files generated by emacs. Changed dynamodb-doc -> aws-sdk.
* 2016/02/03 - v0.0.6 - Fix memCacheLifetime parameter## License
Copyright (c) 2015 [SC5](http://sc5.io/), licensed for users and contributors under MIT license.
https://github.com/SC5/aws-document-cache/blob/master/LICENSE[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/SC5/aws-document-cache/trend.png)](https://bitdeli.com/free "Bitdeli Badge")