LDAP-cache to minimize nbr of queries when unnesting groups.

A new cache named "ldap_groups_byinclude" is introduced
to help lessen the number of queries needed to resolve
the nested LDAP-groups.

Depending on the LDAP tree structure, the unnesting of
the LDAP-groups will in many cases generate most of the
queries against the LDAP-server. Even though the users
have lots of security groups in common, no effort was
previously made to reuse the looked up LDAP-group
hierarchies.

This change introduce a cache which maps the group DNs
inheritence. The expiration time is set to 1h, which
allows any LDAP changes to be reflected in gerrit within
a reasonable time. Though for most companies the
hierarchical group structure is mostly static.

Change-Id: I913f0e8fffb9116d24ebeb12d004dfa2495a1080
3 files changed