Some issues to reflect on:

  1. How do you determine when you can serve from cache and when you need to 'refresh'. For example say we were talking this node and you cached the node and all responses at time X. If there is a new reply how do you recognise that the cache entry is now invalid?
  2. How do you plan to expire from cache? If you don't clean out old stuff you will quickly build up lots of files.
  3. Related to the above. If you cache a lot of info you will find some ugliness with the filesystem. As you move towards 10,000 files per dir things start to grind to a halt (except maybe with Reiser FS, certainly with ext2/3). As a result you often need a heirarchy ie A/B/ABlog.dat

You may find that squid fills the ticket very nicely. Look for http accelerator mode in the FAQ. In essence you set up squid on port 80 and your httpd on say port 81. The incoming requests all hit squid (which is the defacto standard caching server). If squid reckons it is cachable it serves it from its cache, otherwise it gets it from your web server. The beauty is that all the details are taken care of. As always YMMV and dynamic content is more suited to a customised approach.

cheers

tachyon


In reply to Re: Ways of caching by tachyon
in thread Ways of caching by kiat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.