mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-22 07:14:21 +00:00
perf(core): cache the schema of LDAP user sources
This commit is contained in:
1 parent
debcbd16db
commit
d0056d3b27
3 files changed
+33
-7
No files matched your search
@@ -440,6 +440,8 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
||||
- (NGLdapConnection *) _ldapConnection
|
||||
{
|
||||
NGLdapConnection *ldapConnection;
|
||||
NSString *value, *key;
|
||||
SOGoCache *cache;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
@@ -459,7 +461,20 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
|
||||
if (!_schema)
|
||||
{
|
||||
_schema = [LDAPSourceSchema new];
|
||||
[_schema readSchemaFromConnection: ldapConnection];
|
||||
cache = [SOGoCache sharedCache];
|
||||
key = [NSString stringWithFormat: @"schema:%@", _sourceID];
|
||||
value = [cache valueForKey: key];
|
||||
|
||||
if (value)
|
||||
{
|
||||
[_schema setSchema: (NSMutableDictionary *)[value objectFromJSONString]];
|
||||
}
|
||||
else
|
||||
{
|
||||
// We go check in the LDAP directory
|
||||
[_schema readSchemaFromConnection: ldapConnection];
|
||||
[cache setValue: [_schema jsonRepresentation] forKey: key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user