I have a really strange problem. I'm using object cache to faster retrieve results when using SPQuery.

My code to get items is as follows:

PortalSiteMapProvider ps = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode;
var items = ps.GetCachedListItemsByQuery(((PortalSiteMapNode)ps.CurrentNode).WebNode, "mylistname", myQuery, site.RootWeb);

When I run this code I get all results which satisfies condition in query (no matter how many times I refresh page). However if I make any changes to list (add or delete item), the object cache returns the changed set of items only once. Next time I refresh page I get 0 results.

E.g. if I had 5 items and then I add 1 new item, I get 6 items which is correct result. But when I refresh page again I get 0 results. This state persists until I recycle app pool or flush object cache.

My Object cache is set to 300MB, it's checking for changes when query is executed and multiplier value is set to 3.

Any ideas what could be source of my problems?

Any advice is welcomed! Thanks.


I looked into ULS and found this entries when 0 items are returned:

Cache miss for query Web (nor all entries not found) "query .... "
Fetching 4294967295 items.
Fetching super user items.
Fetching SuperReader items.
Merging super user and super reader items.
Cache Hit for query Web "query ... "
Creating result set.
Adding super user IDs.
Adding Super Reader IDs.
Nothing from SuperReaders.

3 Answers 3


"Cache miss for query Web" may be the answer. You may be looking at the ULS log for the wrong portion. I would look at the ULS log for the first successful run and see if there is not a cache miss for the list that results in a cache dump for the list you are querying.

You may be able to remedy by changing the query from server side to client side. If I recall correctly client side queries tend to pull the whole list before running the query, so I think you may get cache hits every time.

  • Hi, I finally got to your suggestion. I've found these in ULS:ache miss for query Web (nor all entries not found), Fetching 4294967295 items., Fetching super user items.,Fetching SuperReader items.,Merging super user and super reader items.,Creating result set.,Adding super user IDs.,Adding Super Reader IDs.,Content from SuperReaders and SuperUsers. Merging....Is cache miss a problem? TY
    – luccio
    Commented Sep 2, 2013 at 21:29
  • It is if it results in the cache being flushed and you are only querying the cache. If you stop trying to out-wit the cache-ing engine and go client side you should almost always get cached results. It is worth checking out the performance difference.
    – ghangas
    Commented Sep 3, 2013 at 15:54

Cache misses are mostly likely to happen because of insufficient memory as they all are stored in Ram. If not then mostly cause must do with the Cache configuration. I would suggest to try the different settings specified for the object cache like changing the maxSize directly in the web.config etc. in the article below,


Also ensure that the object cache user accounts are configured properly like mentioned in the below article,


  • Hi, there is enough memory (assigned 300MB in web.config) and on VM is >4GB available. Accounts were configured according to that article.
    – luccio
    Commented Aug 30, 2013 at 9:02
  • ok,Can I know whats the total Ram assigned to the VM and is it SP2013 or SP2010? Also did you try passing the currentWeb instead of site.RootWeb as the last parameter of GetCachedListItemsByQuery() ?
    – msounthar
    Commented Aug 30, 2013 at 9:31
  • Hi, it's SP2010 and VM has ~4GB RAM, it's dev enviroment. I did try passing SPWeb w/o any change.
    – luccio
    Commented Sep 2, 2013 at 8:05
  • 4gb Ram is the minimum requirement for SP2010, Since this issue is weird I suggest you can try out your code in a another machine with more Ram. You can try cloudshare which provides you free trial machine with 8gb ram where you can test your solution.I know its quite a stretch but by this way you can rule it out whether its due to the environment.
    – msounthar
    Commented Sep 2, 2013 at 8:16
  • I've added extra 4GB to VM w/o any change.
    – luccio
    Commented Sep 2, 2013 at 21:30

i think and not sure this is realted to the cache profile modify an item make the cache dirty and thats why your next request is giving you nothing .. because the object is no longer valid take a look and play with the cache profile settings .. there is a couple for intranet and extranet or anonymous


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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