directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1547048 - /directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
Date Mon, 02 Dec 2013 14:58:37 GMT
Author: elecharny
Date: Mon Dec  2 14:58:37 2013
New Revision: 1547048

URL: http://svn.apache.org/r1547048
Log:
Added a alias cache to speed up searches

Modified:
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1547048&r1=1547047&r2=1547048&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
Mon Dec  2 14:58:37 2013
@@ -147,7 +147,27 @@ public class DefaultSearchEngine impleme
         // --------------------------------------------------------------------
         // Determine the effective base with aliases
         // --------------------------------------------------------------------
-        Dn aliasedBase = db.getAliasIndex().reverseLookup( baseId );
+        Dn aliasedBase = null;
+        
+        if ( db.getAliasCache() != null )
+        {
+            Element aliasBaseElement = db.getAliasCache().get( baseId );
+            
+            if ( aliasBaseElement != null )
+            { 
+                aliasedBase = (Dn)(aliasBaseElement).getObjectValue();
+            }
+            else
+            {
+                aliasedBase = db.getAliasIndex().reverseLookup( baseId );
+                db.getAliasCache().put( new Element( baseId, aliasedBase ) );
+            }
+        }
+        else
+        {
+            aliasedBase = db.getAliasIndex().reverseLookup( baseId );
+        }
+        
         Dn effectiveBase = baseDn;
         String effectiveBaseId = baseId;
 



Mime
View raw message