PHP Classes
elePHPant
Icontem

What is the best PHP page caching class?: Need best caching to store XML documents

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  All requests RSS feed  >  What is the best PHP page caching class?  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

What is the best PHP page caching class?

Edit

Picture of Siva Kumar by Siva Kumar - 8 months ago (2015-06-10)

Need best caching to store XML documents

This request is clear and relevant.
This request is not clear or is not relevant.

+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 Clarification request
  • 1. Picture of Dave Smith 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. Picture of Siva Kumar 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. Picture of Dave Smith 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. Picture of Siva Kumar 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.

Ask clarification

3 Recommendations

PHP Action Deferer: Defer execution of actions until the script ends

This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Manuel Lemos by Manuel Lemos Reputation 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.


Cache Master: Store and retrieve data in cache files

This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Anthony Amolochitis by Anthony Amolochitis package author package author Reputation 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.


Auto Ajax: Update page parts with AJAX when links are clicked

This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Dave Smith by Dave Smith Reputation 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 Comment
  • 1. Picture of Siva Kumar 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

    1. After output send the user as "Manuel Lemos" said i have used the register_shutdown_function to store fetched data and next set data into a database.
    2. Later i have cached the data using memcahe with yii framework cdbcachedependency module.
    3. Later when another user requesting the sameset of data i am serving this from cache not from Externalweb service.
    4. For modified bookings in between first user-access and second user-access i am maintaining a notification receiver which receive notification from external webservice and update the db and cache accordingly.

    Every day this data will truncated at 0th hour.

    Please mention your feedback for any alternatives


Recommend package
: 
: