httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jérôme Renard>
Subject Re: persistent data : common/best practices
Date Sun, 24 May 2009 09:55:14 GMT
Hi Joe, a écrit :
>> My use case is actually the following :
>> - I have to fetch a few rows in a specific table (around 10 rows)
>>    but I do not want to fetch these rows for every request as I know
>>    they will not change often (but I can not use a configuration file
>> here).
>> I thought about "caching" the result of this fetch so it is created once
>> and every subsequent request could use it without hammering the database.
> My suggestions :
>   - Populate an apr_table_t with the data.
>   - Use a shared memory segment so that if you use the prefork MPM, each
> process can still access the data (use mutexes to keep things sane).
>   - Use a time stamp on the data entries just so that (after they
> "expire") you can go back and reload the data from the database.
>   - Use a configuration option to set the "expire" value so that the
> module can be adjusted as the load on the db increases.
> I don't have any example code with me right now due to where I am, but you
> should be able to google for it, or even check the apache source for
> examples.  There is much out there.

Thanks for your help! :)

Jérôme :)

View raw message