]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/oc.c
ITS#2919 move OpenLDAPtime to OpenLDAPperson
[openldap] / servers / slapd / oc.c
index 651041f93486f8ca10dad35905cf2bb151373e85..4afb1e17514476afc4b7b5725ceeb8b713c2af86 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -119,6 +119,7 @@ struct oindexrec {
 };
 
 static Avlnode *oc_index = NULL;
+static Avlnode *oc_cache = NULL;
 static LDAP_SLIST_HEAD(OCList, slap_object_class) oc_list
        = LDAP_SLIST_HEAD_INITIALIZER(&oc_list);
 
@@ -161,9 +162,17 @@ oc_bvfind( struct berval *ocname )
 {
        struct oindexrec        *oir;
 
+       if ( oc_cache ) {
+               oir = avl_find( oc_cache, ocname, oc_index_name_cmp );
+               if ( oir ) return oir->oir_oc;
+       }
        oir = avl_find( oc_index, ocname, oc_index_name_cmp );
 
        if ( oir != NULL ) {
+               if ( at_oc_cache ) {
+                       avl_insert( &oc_cache, (caddr_t) oir,
+                               oc_index_cmp, avl_dup_error );
+               }
                return( oir->oir_oc );
        }