On Wed 06 Feb 2008, titetluc titetluc wrote:
> The module I am developing has to delete the cookie if it is not refreshed
> regularly.
> The question: how can I manage this timeout inactivity ?
> The best solution would be to use a mechanism where callbacks (deleting t=

> cookie rfom the database) would be called automatically on inactivity.
> Does such an API is proposed by :
> =A0 =A0 =A0. the APR API
> =A0 =A0 =A0. mod_perl API
> =A0 =A0 =A0. an Apache2::xxx perl module
> =A0 =A0 =A0. a CPAN module
> If not, how can I solve my problem ? (I could verify regularly in the DB
> storage, but this is a last resort solution. Even in this case, how could=

> implement it ?)

Apache (at least 2.2.x) implements a "monitor" hook, see server/mpm_common.=
To use this hook you'd have to write a bit XS stuff like Geoff's=20
AuthenHook, ... since there is AFAIK no CPAN module. This hook is run from=
time to time in the parent apache.

Otherwise there are 2 standard ways to do that:

=2D a cron job or something similar in the DB itself
=2D check each time in a connection cleanup handler (to do it not too often=
can use a global variable that holds the timestamp of the last cleanup and=
run it only if the difference to the current time grows too big.)

I'd go for one of the standard ways since:

=2D easier to implement
=2D your code doesn't run as root