Giter VIP home page Giter VIP logo

Comments (15)

kwhitley avatar kwhitley commented on August 19, 2024 1

This will be rolled into v1.x

from apicache.

kwhitley avatar kwhitley commented on August 19, 2024

Very solid idea @Kuzmin... if you want to implement a promise-based solution and submit a PR I'd be happy to review and merge. Otherwise, I'll add this to the list!

The core of this lib is by now quite dated and needs a complete rewrite (with or without backwards compatibility hooks)... this is definitely something to add to the requirements for that at the very least!

from apicache.

Kuzmin avatar Kuzmin commented on August 19, 2024

Did a test implementation of this in an own package since I felt I didn't need all the bells and whistles that this package has. It seems to work rather well, but I really need to add more test cases.

The code can be found here: https://github.com/Kuzmin/node-cache-middleware

Feel free to rip the relevant parts. If you want, I can do these changes when I get some free time.

from apicache.

kwhitley avatar kwhitley commented on August 19, 2024

Awesome, thanks @Kuzmin - I agree re: the package... upcoming major release is going to be so much leaner, and just more easily allow for user extension... I'll let everyone come up with their own flavor of modding it that way.

from apicache.

svozza avatar svozza commented on August 19, 2024

This feature would be very useful for me, I'd be more than willing to have a crack at it and submit a PR. Although, I'd rather wait until #62 has been merged before I start.

from apicache.

Kuzmin avatar Kuzmin commented on August 19, 2024

Hey @svozza, I don't know what features you need but you could take a look at my implementation a bit higher up. It has less features than this project, but might be enough for what you need until apicache has this added! I've tested my implementation in production for a few months now and it handles load nicely :)

from apicache.

Kuzmin avatar Kuzmin commented on August 19, 2024

Actually, looking again, it seems like apicache has added a bunch of features since the last time I was here, so it might not be as feasible as I thought. But yeah, just wanted to show the option.

from apicache.

svozza avatar svozza commented on August 19, 2024

Yes, I did see it and it looks easy enough to create an adapter for Redis but I'm quite happy with apicache at the moment. What sort of traffic are you doing in production?

from apicache.

kwhitley avatar kwhitley commented on August 19, 2024

@Kuzmin @svozza my main concern is making sure the API/interface remains unchanged to prevent legacy breakage. Given the number of downloads a month, that's kind of an issue at this point. I do plan a complete rewrite for version 1.0.0 but would still like to continue support of most of the v0.X.X interface if possible...

That said, I love the lease concept to prevent duplicate parallel calls, but not sure (off hand without much thought mind you) how to accomplish this without callbacks or promises at this point. Thoughts?

from apicache.

svozza avatar svozza commented on August 19, 2024

Yeah, my only consideration is preventing dogpiling, I didn't envisage any API changes, it should be completely transparent to the user.

from apicache.

svozza avatar svozza commented on August 19, 2024

Ah, I see what you mean about without callbacks, the in memory version is synchronous. We could only support this feature for Redis, given that the node-redis client has an asynchronous API.

from apicache.

Kuzmin avatar Kuzmin commented on August 19, 2024

Hey @kwhitley! You could check my implementation, it just passes the first request to a path through, and then stores the subsequent calls in an array. As the first call completes, it iterates through this array and sends out the response to these. It doesn't use promises or callbacks in a more heavy way than your current implementation.

Does this make any sense? I could try expanding the explanation if not. (Just in a bit of a time crunch personally right now.)

from apicache.

Kuzmin avatar Kuzmin commented on August 19, 2024

To clarify regarding callbacks: The only callbacks that I have used are the ones that hook into the res.end/res.write events, the rest of the code is just moving res objects around arrays in a synchronous fashion. So it is "synchronous" in that sense.

from apicache.

matteinn avatar matteinn commented on August 19, 2024

Hey @kwhitley, is this still planned for future releases?

from apicache.

steveocrypto avatar steveocrypto commented on August 19, 2024

Any chance this update is coming soon? @kwhitley Running into the same issue where concurrent requests are bypassing cache, and results in massive duplicate keys in the index.

from apicache.

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.