SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2013
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to create server Cache for static page

    I developed a website. Now i want to create server cache for this site to avoiding overload and easy to load. Hi, i am not sure about this topic so anyone explain in detail how to create cache and then how to make changes in cache. share your ideas and suggestions.
    Last edited by EastCoast; Jun 26, 2013 at 16:22. Reason: removed link

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,551
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    The easiest way would be to use an in-built or plugin cache facility if you are using a CMS that has this. Secondly, you can use a web server module such as apache mod_cache if your hosting allows installation or modification of the web server. There are also applications like varnish or squid that can act as a cache in front of apache, however setting this up requires a bit more knowledge of server administration.

    It's quite easy to write caching code. On each page load, check whether a cache exists and is within an allowed 'age', if so open and serve this file, if not go through your normal page generation and write it to disk and serve.

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,650
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Mike,

    While I concur IF the question had been for dynamic pages, the question was for a static page. How much benefit can be gained by caching a static page? Just off the top of my head, I can't imagine any benefit unless the caching includes compression ... which can be done without caching, i.e., as part of creating the static page.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,629
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I have seen performance gains from memory caching static pages but that was under extreme circumstances -- namely a massive DDOS attack. Under normal circumstances the only thing that would help you here is if you had horribly slow disk performance and that is an easy problem to fix.

    If you really want to pursue this I would consider using nginx or varnish as that is what they are designed to do and they do it very, very well.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •