Comments (3)
An lru-cache + cacache system sounds pretty cool, and that's definitely the approach I'd explore first. You may want to look at http://npm.im/async-cache as a way to hook them together. (Async-cache is lru-cache where items are fetched asynchronously. It's a bit dated, so no fancy promise handling etc, but there's not a lot to it, so it's fairly stable.) Given the context of a docker container, where a crash means the fs is blown away anyhow, that's probably the best way to go.
I don't think it's a great idea to add an LRU or max size to cacache itself, though. It would require making this thing a bit more bloated than I'd like it to be, since managing the LRU info and tracking size is a whole other job.
If you wanted a persistently size-limited LRU-pruned file system cache, that's another interesting idea, but would require some additional orchestration on top of cacache to make it work. Doing so in a way that's not prone to parallel processes clobbering one another, or falling over by trying to keep too much in memory, would be a bit tricky, but probably doable. I know it's not what you're necessarily needing, but it'd be a cool project if someone wanted to take it on, and cacache would probably be a good fit for the underlying storage layer.
So, WONTFIX
, but I think you should pursue it :)
from cacache.
@isaacs, Thanks for the quick reply!
I already started working on an lru-cache + cacache module and it looks pretty good (Both lru-cache and cacache had everything I needed π).
Also managed solve the ram-fs-persistency problem (for non-docker) by using cacache.ls and populate the lru-cache on startup.
If you interested, you can see here:
https://gist.github.com/amotzte/8a87cc7fd53ffd02d3b8fa7d52d4434a#file-lru-cacache-js-L64-L75
Will test it more and will publish it if all goes well.
from cacache.
Your gist link is dead, any updates on this? @amotzte
from cacache.
Related Issues (20)
- [BUG] TypeError: buckets.map is not a function => app crash HOT 3
- [Feature] Async iterator over ls.stream HOT 2
- ΠΊΠ°ΠΊΠ°Ρ ππ€£
- [BUG] cacache ignores npm cache config HOT 2
- [ISSUE] Explain to me why this is a stupid use of cacache (storing simple key/value pairs with a simplified cacache interface) HOT 4
- [BUG] cacache doesn't work on Android HOT 7
- [BUG] `rm.all` doesn't delete anything on Windows HOT 3
- [QUESTION] Get info by integrity? HOT 1
- [BUG] @npmcli/move-file is dilicated HOT 1
- [BUG] put.stream can crash the process with unhandled exception, even when error handler is attached
- [Vulnerability] [email protected] dependency [email protected] contains memory leak HOT 1
- [FEATURE] custom integrity method / digest algorithm (xxhash) HOT 1
- [BUG] EMFILE error in environment with low file descriptors limit HOT 3
- upgrade tar to 6.2.1 HOT 1
- CVE-2020-7774 HOT 1
- [BUG] Put failed due to TypeError: Data must be a string or a buffer
- [FEATURE] implement reference counting HOT 1
- [BUG] calling verify() should not modify the time property
- Could you help remove the vulnerability in your package? HOT 1
- [BUG] cacache package depends on vulnerable version of tar HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cacache.