I've done something very similar in my calendar application and it seems to work really well. It's not a high-load application, so my primary motivation was to improve the response time by cutting off dynamic calendar view computations when there are no changes. I get about 50% improvement in response time when pages are viewed. The downside is that there is a slow down when pages are updated, but I figured the users of my application would be okay with a slight delay when they click "Save Changes" in exchange for faster loading pages when viewing. When users make updates to one of the pages I just replace the corresponding text file in cache. I do take concurrency issues into account, so I use flock() whenever a cache file is accessed for update. At the same time if the same file is requested from the cache while it's being written to, I detect that and return a dynamically generated page instead. Whenever more than one page is affected by a change, the application updates the page that is currently viewed first, returns that page to the user and then forks a separate process to finish updating other affected pages.

I could show you some source code if you're interested.

Alex

In reply to Re: Ways of caching by relax99
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.