-
Notifications
You must be signed in to change notification settings - Fork 137
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
Caching and Pagination ? #63
Comments
@danramteke Is your app open source, by any chance? If not, would you be able to reproduce this in a fresh rails app using kaminari and api-pagination and send me the app's code? |
Just had the same problem. This override is skipped if the application serves the cached results, so in order to get the correct (full) headers in case the request hits the cache, we have better to paginate what the cache returns instead of paginating inside the cache block. Something like the following should work:
|
@davideghz as the author stated, this way you're going to put all posts into cache, and u might have milions of them, so that's not a good solution. |
Hi!! Did anyone find a solution for this? I am having the same issue... |
Hey all, sorry that there's still an issue with this. I'm still happy to look into this, but I haven't experienced the issue, so having access to the source code of one of these apps that I can run locally would help. Or even just a dummy Rails app that's set up to reproduce the problem. |
Hello @davidcelis! Thanks for the reply... I have created a toy project to test this (https://github.com/alemata/pagination_and_cache) I know this is not the ideal code to test but it's an idea of the issue Ideeally we should be able to paginate... store that page result in cache and send the responde with pagination headers... Sorry if I am being not so clear... please ping me with any question |
@davidcelis were you able to review this?! was the project helpfull? |
Ok I think I make it work...
I am not sure if there is a |
Hi, I'm having a little trouble getting Rails caching to play nicely with this gem. Here's some psuedo code that matches my code fairly well:
If I do this, I will get the api_pagination HTTP headers. However, I'm loading all of the
current_user
's posts into memory, which seems like a bad thing.If I paginate inside the caching block (like below), then I don't get any api_pagination HTTP headers.
Can someone point me in the right direction? I'm having a hard time googling for API Pagination and Rails caching. Perhaps I'm missing something fairly obvious. I'm using kaminari, if that helps.
Thanks so much!
The text was updated successfully, but these errors were encountered: