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…
What it does
In the maker’s words, at launch
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!
Does the same job
all alternatives →
- DNDistribucache – Node.js datastore-independent repopulating cache2015 · github.com · ▲7




More life & fun this month
the category →- TL
Life & fun · 10d ago · louisabraham.github.io

Photosynthesis fires two of your iPhone
Life & fun · 28d ago · photosynthesis.camera
SoloUno▲310Take control of hair pulling, nail biting & skin picking
Life & fun · 28d ago · solouno.io

Scroll through all 43,252,003,274,489,856,000 reachable Rubik's Cube permutations.
Life & fun · 26d ago · everycube.alen.is


Hi HN, I built Eigendrum, a web tool that solves the 2D wave equation for arbitrary shapes so you can hear what they sound like as drums. How it works: * Solves -∇²u = λu using finite element analysis (Kφ = λMφ) on a triangle mesh. * Validated to <0.1% error against closed-form solutions for circles (Bessel zeros) and rectangles. * Sound model factors in strike location, Rayleigh damping, and mallet width. * Includes Kac drums I & II to demonstrate identical sound spectra from different geometries. * No frameworks, build steps, or dependencies. Repo and tests:…
Life & fun · 26d ago · baselashraf81.github.io
Launched alongside, March 2012
the whole month →- TUThis up votes itself▲3,531
Life & fun · 2012 · news.ycombinator.com
- AW
I submitted a link, when someone clicks on it I get an up-vote for this article. I don't want people to misuse this I just want to bring attention to this problem. This is the link I used that up-votes this: http://news.ycombinator.com/vote?for=3742742&dir=up&...
Life & fun · 2012
- SC
Life & fun · 2012 · streak.com
- FC
Life & fun · 2012 · flutter.io
- ID
Life & fun · 2012 · github.com
- TO
Life & fun · 2012 · itunes.apple.com