Recommend this page to a friend! | Stumble It! | Bookmark in del.icio.us |
All requests | > | What is the best PHP page caching class? | > | Request new recommendation | > | Featured requests | > | No recommendations | ||
by Siva Kumar - 8 months ago (2015-06-10) page caching
+2 | I have a page called "BookingSummary" to view bookings based on categories like past, preset, future, etc.. By default the page shows the first 20 future bookings. Based on a flag, if bookings exceeded 20 then pagination applied like 1, 2, n . But when user clicks pagination link then my page contact external Web service and get the data this is taking too much time. My plan is to reduce the delay in page loading time. I identified two below steps: Step 1: Remove the pagination with next and prev instead numbering Step 2: When viewing the default page i.e (first 20 bookings) in the back-end I want to load "next" bookings into cache and load immediately when user request them. |
1. by Dave Smith - 8 months ago (2015-06-10) Reply
How often are new bookings added on the external web-service?
This will determine the best caching approach.
If you do wind up pre-loading the next and previous pages, I think you would have to use ajax to accomplish it.
2. by Siva Kumar - 8 months ago (2015-06-10) in reply to comment 1 by Dave Smith Comment
On an average 150-180 bookings added for every hour
3. by Dave Smith - 8 months ago (2015-06-10) in reply to comment 2 by Siva Kumar Comment
So that is about 1 every 20 seconds. Regardless of whether you pre-load or get paged data live you have a duplicate result problem whenever it takes more than 20 seconds for a user to review a result set, which increases with each view of the next page.
A quick example, I look at the first set of 20 bookings, while doing that you are fetching the next set (page). When I press next you display the fetched data and fetch the next set in the background. At this point, everything looks great, however the next set of data that you have fetched is more current by the amount of time it took the user to view the first set and press next. By the time the user presses the next the second time they will start to see duplicates from the page they where just on because of the new bookings that have pushed the results to different pages.
If that behavior is acceptable, then ajax is the way to go which is javascript instead of php.
If that is not acceptable, then a solution would be to have an updating script working in the background which grabs a certain amount of records to cache and a display script that uses the most recent cache for all displays during that session. You know this is the solution a site is using when the results are time stamped. This can be done with a php class.
4. by Siva Kumar - 8 months ago (2015-06-10) in reply to comment 3 by Dave Smith Comment
Yes,that behavior is acceptable.
Could you please provide any developed package for this??
Thank you for your response.
+2 | by Manuel Lemos 11100 - 8 months ago (2015-06-11) Comment If you want to compute your first page of 20 results and at the same time return them to the browser while computing the next 20 results, you can use this class that lets you do both things in parallel. It is very interesting because it uses PHP register_shutdown_function to execute arbitrary code even after you have finished serving the current page output. |
+2 | by Anthony Amolochitis 325 - 8 months ago (2015-06-10) Comment If you are looking to cache, I believe I have a class to make the backend cache process easy for you. As for the logic that was discussed in the comments prior, that will have to be worked out based on what satisfies your customers. My cache class will allow to set an expiry time as well. I hope this helps. Let me know if you need more examples on how to use it if so. |
+2 | by Dave Smith 5955 - 8 months ago (2015-06-10) Comment This is the closest I could find here and it looks like it needs a couple of other classes to operate. Since what you are after is mainly javascript, I would also try looking at the sister site jsclasses.org where there may be something more robust. |
1. by Siva Kumar - 8 months ago (2015-06-16) Reply
Thank you very much for you concern about my problem.
I am trying to solve the issue like below
Every day this data will truncated at 0th hour.
Please mention your feedback for any alternatives
Recommend package | |
|