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);
}
}