locked
OData: Caching & Paging: a good idea? RRS feed

  • Question

  • Is it a good idea to implement caching on the returned iquerable, when you are using paging?

    Is the caching/paging mechanism smart enough to handle this, or are you potentially caching/returning only parts of the data?

    Wednesday, September 19, 2012 9:18 AM

All replies

  • It depends how exactly you would implement it.

    Assuming the underlying data don't change, the expression tree provided to the IQueryable for execution contains everything. So if the same query is sent twice the same expression tree will be generated and the same results are expected to be sent back. So caching those would make sense.

    The problem with caching in OData is that clients may construct the query programmatically and thus the service might end up seeing lot of slightly different queries which makes caching rather hard.

    Thanks,


    Vitek Karas [MSFT]

    Wednesday, September 19, 2012 11:15 AM
    Moderator