Allan Clark - 2001-11-16

Hey all;

I'm trying to reduce this with a configurable cache:
> 78 Query       select user_passwd from user_auth where user_name='loopus'
> 78 Init DB     docaccess
> 78 Query       select user_passwd from user_auth where user_name='loopus'
> 78 Init DB     docaccess
> 78 Query       select user_passwd from user_auth where user_name='loopus'
> 78 Init DB     docaccess
> 78 Query       select user_passwd from user_auth where user_name='loopus'
> 78 Init DB     docaccess

What I'm thinking of is a configurable (ie user-selectable timeout) on the most recent successful authentication.  In this case, I would configure the timeout for maybe 5 seconds.  When 'loopus' gets a document, the mod wants to look up the password.  Now, if the username and password match the cached values, and the timestamp of the cache is less that 5 seconds ago, the module allows access without checking.  If any of these is false, the module checks the DB as per normal.  timeout of 0, the default, means deactivate the cache.

The caveats here is that it would take 1 x the timeout of no one accessing using a user/pass pair that is changed before the cache goes stale. Alternatively, someone has to successfully authenticate on a different user/pass to wipe out the cached value.  I guess though when the user/pass doesn't match the new password, then the module checks, and will cache the successful result, wiping out the stale password before the timeout occurs.

If no one has a problem with this, I can look at trying this, resulting in a patch.