Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

FindPagesWithCritera / SearchDataSource and cache

Does either or both of FindPagesWithCriteria and SearchDataSource cache the results of a query? What I mean is, if i execute the same query twice in a short time and no page changes have been made, will the query still go to the database or not?
Oct 01, 2009 7:25

Short answer: No.

Long answer:
FindPagesWithCriteria will do one database request per criteria (and possibly language) you provide to get the a PageReference to every page that matches the query. Then it calls GetPage on datafactory for each reference returned. This will of course be cached, so a second query could be significantly faster than a first one that returns uncached pages.
So to summarize, each page is cached but the query itself isn't.


Oct 01, 2009 8:16

Thanks for the quick reply.

So if I want to speed things up I could cache the result in a key based on the query for example? What should I cache - the PageDataCollection or an array of PageReferences or ID:s? I mean - if I cache the PageDataCollection, will that mean that I duplicate the data cached by DataFactory for each PageData object?

Oct 01, 2009 8:27

I would say have a look at the CacheFramework on EPiCode for an implementation.

Oct 01, 2009 8:36
I'll check it out, thanks!
Oct 01, 2009 8:41
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.