This looks promising. We've got this problem right now. One of our routes 
fetches a lot of data and does a lot of parsing/processing and end up kind 
of slow. We will definitely try this.
Thank you

On Sunday, 19 October 2014 18:09:11 UTC+2, Tom Boutell wrote:
>
> We've just released a module that kicks in automatically and provides 
> caching when an Express route is hit by more than one visitor 
> simultaneously:
>
> https://github.com/punkave/express-cache-on-demand
>
> This is a new approach to caching. Rather than holding on to the data for 
> an arbitrary amount of time, we simply deliver the same data to any 
> visitors who arrive during the period of time we're generating a response 
> for the first user.
>
> After that's done, when a new request arrives, we let the route generate a 
> new response.
>
> So the content is always timely, and yet the server is never overwhelmed.
>
> This middleware is intended for routes that do a lot of work, then deliver 
> a response under 1MB or so. Rendering a web page after fetching lots of 
> related data from different sources is a perfect example.
>
> "Should I apply this to my entire site?" No. This middleware is NOT 
> intended - and will NOT work - for responses that call res.sendFile(), or 
> pipe data into "res". Generally speaking, these kinds of responses don't do 
> a lot of work up front, and you did it this way to avoid holding something 
> big in memory. So just don't apply the middleware to routes of that kind.
>
> The middleware is smart enough to automatically skip the cache if a user 
> is logged in (req.user exists), or their session doesn't look empty, or the 
> request is not a GET or HEAD request.
>
> Looking forward to your feedback!
>
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/6a55913c-7ac2-408a-af7a-3a94055f7d25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to