St

Stash, a graph-based cache for Node.js and Redis

Hacker News

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 card

Actual performance

56points
8comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Hacker NewsStrong engagement from HN community · Strong signals: ide, io · Missing: https docs, excited, just released
65%65% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Indie HackersFits the IH revenue-focused audience · Strong signals: started · Missing: supports, reddit linkedin, podcasting
60%60% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
46%46% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Product HuntUnlikely to reach the leaderboard · Strong signals: model, models, code · Missing: mac, agents, macos
36%36% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: way · Missing: mobile apps, ios, personal
36%36% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
12%12% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Py
Pyo – A promise-based Node.js wrapper for the Yo API49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Pyo – A promise-based Node.js wrapper for the Yo API

Hacker News4
gR
gRPC and Kafka based microservices using Node.js62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

gRPC and Kafka based microservices using Node.js

Hacker News1
Vi
Vim2html for node.js43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Vim2html for node.js

Hacker News2
TD
TDD Given-When-Then for Node.js48%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TDD Given-When-Then for Node.js

Hacker News1
Co
Coolx5 - Node.js, Websockets, MongoDB and a clickable zombie50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Coolx5 - Node.js, Websockets, MongoDB and a clickable zombie

Hacker News2
Ye
Yet Another Node.js Logger – femto-logger37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Yet Another Node.js Logger – femto-logger

Hacker News1
HT
HTML5 MMORPG – Node.js54%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

HTML5 MMORPG – Node.js

Hacker News11
Re
Regex Expansion in Node.js47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Regex Expansion in Node.js

Hacker News1
No
Norby – Call your Ruby libraries from Node.js47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Norby – Call your Ruby libraries from Node.js

Hacker News5
A
A Node.js delta encoder43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Node.js delta encoder

Hacker News3