Code Monkey home page Code Monkey logo

Comments (3)

isaacs avatar isaacs commented on May 28, 2024

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.

amotzte avatar amotzte commented on May 28, 2024

@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.

AbdulBsit avatar AbdulBsit commented on May 28, 2024

Your gist link is dead, any updates on this? @amotzte

from cacache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.