+ """
+ Returns (valid, in_cache)
+ where 'valid' means the (user,host,password) was valid in the database
+ and 'in_cache' means it was validated against the local cache
+ """
+ now = time.time()
+
+ global _authenticate_user_cache
+ c = _authenticate_user_cache.get((user,host,password))
+ if c != None:
+ if c['valid'] and now < (c['time'] + _cache_positive_ttl):
+ return (True, True)
+ if not c['valid'] and now < (c['time'] + _cache_negative_ttl):
+ return (False, True)
+