c# - How to improve selection descendant speed in sitecore? -
i need select children (descendants) items filtered template id, under specific item. can in 3 way: use getdescendants myitem.axes.getdescendants().where(x => x.isoftemplate(myitem.templateid)).select(x => (myitem)x).tolist(); use xpath string q = string.format("{0}//*[@@templateid='{1}']", myitem.paths.path, myitem.templateid); var result = myitem.database.selectitems(q); use sitecore search api i can't use #3 case. let skip case. xpath selector #2 should work faster #1, problem in first call path. by reason first call content tree specific path slow. after first call similar calls works fast, doesn't matter witch style use #1 or #2. sitecore add cache. how improve speed first call ? though there many ways retrieve items (using link databse mark cassidy has suggested, using siteocre search api etc.) issue cache. if query runs quick enough second time around first time it's part of cache being emptied , refil