code: @Trivial
      private static String toKey(String name, String filter, SearchControls cons) {
          int length = name.length() + filter.length() + 100;
          StringBuffer key = new StringBuffer(length);
          key.append(name);
          key.append("|");
          key.append(filter);
          key.append("|");
          key.append(cons.getSearchScope());
          key.append("|");
          key.append(cons.getCountLimit());
          key.append("|");
          key.append(cons.getTimeLimit());
  
          String[] attrIds = cons.getReturningAttributes();
          if (attrIds != null) {
              for (int i = 0; i < attrIds.length; i++) {
                  key.append("|");
                  key.append(attrIds[i]);
              }
          }
          return key.toString();
      }
docs: Returns a hash key for the name|filter|cons tuple used in the search
  query-results cache.
  
  @param name The name of the object from which to retrieve attributes.
  @param filter the filter used in the search.
  @param cons The search controls used in the search.
  @throws NamingException If a naming exception is encountered.