Code

Updated ldap class.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 08:16:15 +0000 (08:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 08:16:15 +0000 (08:16 +0000)
-Cache the result of get_objectclasses. It took 13seconds when deleting ~20 FAI objects.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9003 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_ldap.inc

index 61ecc9d8a66d4f2f9fc8bd949b950ae8b8dc24f4..642908017b553e236a8ca00710cc2dc60961ec5f 100644 (file)
@@ -1110,6 +1110,12 @@ class LDAP{
         return($objectclasses);
       } 
     }
+
+    /* Return the cached results. */
+    if(class_available('session') && session::is_set("LDAP_CACHE::get_objectclasses")){
+      $objectclasses = session::get("LDAP_CACHE::get_objectclasses");
+      return($objectclasses);
+    }
        
          # Get base to look for schema 
          $sr = @ldap_read ($this->cid, NULL, "objectClass=*", array("subschemaSubentry"));
@@ -1173,6 +1179,9 @@ class LDAP{
       }
 
          }
+    if(class_available("session")){
+      session::set("LDAP_CACHE::get_objectclasses",$objectclasses);
+    }
          return $objectclasses;
   }