You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

aws-document-cache

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-document-cache

Generic document cache based on Amazon DynamoDB

0.0.6
latest
Source
npm
Version published
Weekly downloads
8
100%
Maintainers
1
Weekly downloads
 
Created
Source

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, licensed for users and contributors under MIT license. https://github.com/SC5/aws-document-cache/blob/master/LICENSE

Bitdeli Badge

Keywords

cache

FAQs

Package last updated on 03 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts