Stash, a graph-based cache for Node.js and Redis
Stash, a graph-based cache for Node.js and Redis
Last night, while trying to figure out the best way to implement caching in my app, I had an idea for a dirt-simple caching system based on a dependency graph. The premise I started with is that one of the hardest things to manage in a cache is dependencies between entities. In order to cache items effectively, you inevitably have to duplicate "child" data inside of "parent" entries. Then, when a child is changed, you have to invalidate the child and its parents, and its parents' parents, and so on. To try to help this, I hacked together a simple Node.js library called Stash, which models the cached values as a graph. When you invalidate an item, Stash will walk the graph and invalidate any items that depend on the item that was marked as invalid. The code is available here: https://github.com/nkohari/stash I'm not suggesting that this is by any means a revolutionary idea; it just started as a mental exercise and now I'm wondering if there's any value to continuing to improve it as a library. I'm also interested in what you find to be the most difficult part about caching, and how Stash could be improved to help. Any feedback is appreciated, but bear in mind this is just a few hours worth of work and it has quite a few rough edges. Thanks!
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Correct prediction on native model
Similar products
Pyo – A promise-based Node.js wrapper for the Yo API
gRPC and Kafka based microservices using Node.js
Vim2html for node.js
TDD Given-When-Then for Node.js
Coolx5 - Node.js, Websockets, MongoDB and a clickable zombie
Yet Another Node.js Logger – femto-logger
HTML5 MMORPG – Node.js
Regex Expansion in Node.js
Norby – Call your Ruby libraries from Node.js
A Node.js delta encoder