Currently support LRU in memory caching for dynamodb scans, queries and gets
npm i dynamoose-caching
const Owner = new dynamo.Schema({
name: String,
pets: [String],
})
const OwnerModel = dynamo.model("Owners", Owner)
OwnerModel.plugin(require('dynamoose-caching'))
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} )
Least Recently Used items caches.
Please read the documentation for how to configure the cache
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()
- 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