Skip to content

A plugin for the dynamoose module that allows you to integrate custom caching strategies

Notifications You must be signed in to change notification settings

mogwai/dynamoose-caching

Repository files navigation

Dynamoose Plugin - Caching

Currently support LRU in memory caching for dynamodb scans, queries and gets

npm i dynamoose-caching

Quick Start

const Owner = new dynamo.Schema({
  name: String,
  pets: [String],
})
const OwnerModel = dynamo.model("Owners", Owner)
OwnerModel.plugin(require('dynamoose-caching'))

Override single operation

This will ignore cache operation

let results = await OwnerModel.scan().exec(true)
let results = await OwnerModel.query().exec(true)

Similary for .get()

let owner = await OwnerModel.get("Jim", { ignoreCache: true} )

Strategies

LRU (Default)

Least Recently Used items caches.

Please read the documentation for how to configure the cache

Roadmap

Would like to use this pattern to allow specific queries to be cached instead of whole operations:

model.scan().all().exec().cache()

Or to ignore:

model.scan().all().exec().ignoreCache()

Feature Ideas

  • Passing an object into the plugin options that allows the user to manage the various caches and clear them.
  • Having the option to make operations share a cache
  • Specific a hashing function to use for the LRU Caching strategy
  • MemCache Strategy Implementation

About

A plugin for the dynamoose module that allows you to integrate custom caching strategies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published