expiry-model
A scuttlebutt model that expires keys
Example
var assert = var ExpiryModel = var m1 = var m2 = var stream = m1stream m1 m2
Sync up multiple keys
var assert = var ExpiryModel = var model1 = var model2 = model1model1model1model1model2 var s1 = model1s1 process
Expire keys
var assert = var setTimeout = setTimeout var ExpiryModel = var model = model
Docs
ExpiryModel is like scuttlebutt/model except you can
- configure how long to hold keys in memory before they expire.
- configure when to clean up old data
- configure a cap on how much data to hold in memory
- cleans up the scuttlebutts vector clock over time.
- values set are shallow merged into each other
ExpiryModel(options)
Valid options are maxAge
and max
and anything else you can
pass to lru-cache.
If you set maxAge
to be low then the expiry model will only
hold keys in memory for that long and it will drop them
afterwards, including not passing them onto anyone it
replicates to.
maxAge
defaults to one day and max
defaults to 500.
Installation
npm install expiry-model
Contributors
- Raynos