in reply to AuthDBI : Cache problem + potential error in source ?

It uses a mod_perl cleanup handler to do the cache cleanup, and those only run when the server handles a request. If no one is using the server, the cache will not get cleared.

It's not actually waiting for someone else to log in, but rather for anyone to do ANYTHING on the server. On a server with some traffic, you would not notice a delay.

If you frequently have only one person on the server and are concerned about this, you could run a cron job to request a page from the server and trigger the cleanup handler every minute or so.

  • Comment on Re: AuthDBI : Cache problem + potential error in source ?

Replies are listed 'Best First'.
Re: Re: AuthDBI : Cache problem + potential error in source ?
by Sihal (Pilgrim) on Jan 27, 2003 at 16:02 UTC
    Thanks this is interesting.
    I suppose all our fustration came from the fact that we expected the cache to clean itself up upon apache restart or expiration of the cache delay... And since we cannot prevent our users to login all the time, even if we ask them to keep quiet for 2 minutes ( I hate those marketing guys :-) ).
    Thanx for pointing out that a simple cron would actually solve the problem. Sometimes simples things work best.
      The reason it doesn't clean up when you restart is the shared memory that it uses for storing the cache. You could have a separate cache per process instead. (There's a parameter to control this.) You could also change the module to use something better like Cache::Mmap instead.

      If no one logs in for a while and the data expires, the first time someone performs an action on the server it will still have stale data, but at the end of that request it will be cleared. So, you could say something like "if you've changed your password and your new login doesn't work, just try it again and it will."

        I have a different behaviour here:
        My user can't just login again as you said, because the cache is not cleaned for user X even if user X logs in after the cache's expiration. I have to make user Y login, so that the cache is clear for Mr.X ... Wich is why I posted the question in the first place.
        In theory, if I had only one user, then his cache would never be renewed ( if you follow me so far). Strange, no?