Learning how to cache pages on website

Discussion in 'Site & Server Administration' started by Kuriyaki, Apr 9, 2009.

  1. #1
    I want to create something similar to http://fmylife.com but I ran into several issues. First of all, I have good understanding of HTML, CSS, RSS, PHP, SQL, mySQL, Postgres, etc.

    The problem I have is the following

    • How to create pages dynamically
    • Update for example the homepage, and create a cached version, instead of having to query the database each time
    • How to determine when to update a cached page
    • Basic security for such a site

    In other words, I need to be pointed in the right direction in order to get this working. This is more like a personal project and something that might have potential.

    Thanks for your time.
     
    Kuriyaki, Apr 9, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    You can use something like APC for the caching - http://pecl.php.net/apc. You can also use a squid reverse proxy cache. Another good method, but significantly harder to configure.

    As for updating, you generally set a TTL on the cached version. If your site doesn't change a lot, this can be a fairly extended period of time. Usually this is something you need to determine based on how often your site changes and the traffic load that you receive.
     
    jestep, Apr 10, 2009 IP
  3. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #3
    hans, Apr 10, 2009 IP
  4. tera

    tera Peon

    Messages:
    159
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    try to see php default buffer out or somenthing like this.This is the way i do it and i can keep the mysql statements in an order.Hard to configure but very effective.


    http://gr.php.net/ob_start


    apc sucks(not suitable for you) the other i dont know i will check it.
     
    tera, Apr 11, 2009 IP