one of my client's sites uses an external site to store name, address, etc. information, and rather than maintain that information in 2 places ( our local DB and the 3rd party site ), we use a mod_perl handler to fetch the relevant information and substitute it in templates. requests for http://mysite.com/12345/index.htm are "replicated" by using the ID number in the URI, contacting the 3rd party site, and using the returned information to populate the index.htm template

last week the 3rd party site complained about too many hits to the server, so i implemented Apache::CacheContent for this site. minimized the hits to the 3rd party server, made things faster for endusers because of the lessened amount of 'net traffic, and all seemed fine.

what i didn't realize would be a problem: the sheer volume of these cache files. i now have something like 46,000 cache files ... because of the number of customers that need this replicated data. that's a problem, because even a remote `ls` takes too long.

i want to stuff the cache files somewhere *else*, i.e. one step out of the DocumentRoot ... but i don't see any options in the perldoc to change the location of the cache files. i was thinking about using a DirectoryAlias, but i also need the LocationMatch to trigger the cache/ dynamic content.

anyone done something like this before?

EDIT: the httpd.conf section for the handlers might be useful ...

PerlModule Mysite::Replicate <Directory /home/httpd/mysite.com/html> SetHandler perl-script PerlHandler MySite::Replicate </Directory> <LocationMatch "^/[0-9]"> SetHandler perl-script PerlFixupHandler Mysite::Replicate->disk_cache </LocationMatch>

In reply to Apache::CacheContent and unforeseen side effects by geektron

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.