I am developing it at Ruby on Rails.
Currently, there is a page on the View side that aggregates and draws statistics.
Drawing takes nearly two minutes because it is not stored in DB and has a wide variety of statistics.
Currently, it is not a good user experience, so I am thinking of returning the cached results.
Saving to DB is also a way to do this, but due to business requirements, I want it to be cached, and it takes time to modify the current code to be stored in DB.
In addition, we are considering updating the cache once a day.
I think this can be done with fragment cache etc.
After updating the cache once a day, drawing takes 2 minutes for the first user access because it is not cached.
As long as the first user access is tolerable, the second and subsequent cached results can be returned, which is good, but can't the system manage this first access?
Return cached results and improve user experience for first-time user access
Thank you for your cooperation.ruby-on-rails ruby
Why don't you separate only the statistical information and obtain it separately from Ajax?
Then you can display "Loading..." in the pre-retrieval state, or display the previous statistics before the new statistics come out.
If it's better to simply use cache instead,
Why don't you access the page by yourself with a daemon when the cache is released and cache it in advance?
If creating a daemon is troublesome, set the cache to duplex (A and B), set the cache to aax called from html, and when displaying html, display A if there is A and store it in the B cache.If you don't have A, how about displaying B as it is?
© 2022 OneMinuteCode. All rights reserved.