|FROM ||Wesley Peng
|SUBJECT ||Re: [Hangout - NYLXS] cache a object in modperl
|That's great. Thank you Adam.
Adam Prime wrote:
> If the database doesn't change very often, and you don't mind only
> getting updates to your database when you restart apache, and you're
> using prefork mod_perl, then you could use a startup.pl to load your
> database before apache forks, and get a shared copy globally in all your
> apache children.
> This thread from 13 years ago seems to have a clear-ish example of how
> to use startup.pl to do what i'm talking about.
> If you need it to update more frequently than when you restart apache,
> you could potentially use a PerlChildInitHandler to load the data when
> apache creates children. This will use more memory, as each child will
> have it's own copy, and can also result in situation where children can
> have different versions of the database loaded and be serving requests
> at the same time. If you want to go this way you might want to also add
> a MaxRequestsPerChild directive to your apache config to make sure that
> you're children die and get refreshed on the regular, if you don't
> already have one.
> On 9/13/2020 10:51 PM, Wesley Peng wrote:
>> I am not so familiar with modperl.
>> For work requirement, I need to access IANA TLD database.
>> So I wrote this perl module:
>> But, for each new() in the module, the database file will be
>> downloaded from IANA's website.
>> I know this is pretty Inefficient.
>> My question is, can I cache the new'ed object by modperl?
>> If so, how to do?
Hangout mailing list