-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist cached formatted_data #172
Comments
Actually, I'm still a bit puzzled about what exactly is causing the speed increase when you're using #77. Gollum should be initializing a new instance of Precious::App for each request, so I don't quite see how cashing a page's formatted data will help to make things faster -- unless Page#formatted_data is being called multiple times for a single request of course.
|
I just tested this, Precious:App is only initialized once at startup. |
Ah, thanks, that explains. My bad, should have thought more before responding. :) I very much welcome a PR on the lines of #77. Having Cache adapters is an especially nice idea, making it easy to plug in any kind of cache server if wanted. There are some gems that a implement a basic in-memory cache, like https://github.com/djreimer/mini_cache -- although the only ones I can find that seem to be well maintained are ones that use a separate redis or memcache server. Something like mini_cache might still be useful inspiration though. If anyone is interested in developing this, I'd be glad to advise where possible. |
And there is of course ActiveSupport::Cache, but I don't know how lean it is to require. |
Perhaps it's worth reconsidering #77? This seems to do pretty much what you described. Seems the only hold up there was some nitpicking (I mean that in the nicest way possible) that could easily be addressed on a follow up commit by those giving the feedback, it seems silly to block a good PR simply because you'd do a few things differently (not to mention it deters people from contributing in the first place). |
I'm all fine with the approach in #77, but someone will have to clone the code and open a new PR since the original author has no time for it. :) |
@sirupsen do you want to open a new PR or mind if someone else uses your code to open a PR? I got it working over at https://github.com/Komodo/gollum-lib, although the commits are a bit of a mess and need some cleaning up before I'd PR them. |
You have fresh context, please grab the code and open a new PR :) |
Thanks @sirupsen! Yeah, let's grab the code. It would be good to have a mechanism for ensuring the cache doesnt get too big though -- that's why I mentioned other caching gems. |
@Naatan Any chance you'd be willing to open a PR for caching based on the work in your fork? |
ping We're working hard on version |
Reference discussion: #77 (comment)
formatted_data is only cached for the class instance, invoking gollum-lib again will cause it to load the page all over again. Gollum appears to be affected by this (gollum-lib caching has no effect when using gollum).
Ideally this information should be stored and accessible for the duration of the process.
The text was updated successfully, but these errors were encountered: