I'm using a custom SharePoint WCF to query against Document Libraries.

At first i've tried to use SPQuery. Unfortunately the performance is not that what i am expecting. Takes about 1-2 seconds for 9000 items.

After some research i've discovered the CrossListQueryCache. But it looks like that the object cache only is "alive" during the WCF query. As soon the client receives the result and starts a new query(with the same parameters) there is no performance gain through caching.

Somehow i'm misunderstanding the CrossListQueryCache. Any ideas why it's not caching on independents subsequent calls?

using (SPSite site = new SPSite("http://mysite"))
    using (SPWeb web = site.OpenWeb())
        CrossListQueryInfo query = new CrossListQueryInfo();
        query.Query = "<Where><Eq><FieldRef Name='ContentType' /><Value Type='Text'>My content type</Value></Eq></Where>";
        query.Lists = "<Lists BaseType='1' MaxListLimit=\"0\" />";
        query.UseCache = true;
        CrossListQueryCache cache = new CrossListQueryCache(query);
        DataTable table = cache.GetSiteData(site);
        table = cache.GetSiteData(site);

1 Answer 1


Try setting query.Webs:

query.Webs = "<Webs Scope=\"SiteCollection\" />";

See if that makes a difference.

I also found another site that might help: http://sharepoint.nailhead.net/2008/04/musing-on-crosslistquerycache-class.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.