Mulitple requests on a cached action

Feb 3, 2012 at 4:16 PM

When an action to be cached is requested and then requested again before the first request is completed (and cached), what occurs?

Does request 2 wait on the cached response of request 1?
or, Does request 2 execute the action as if uncached and then cache the results over the initial requests cached result?
or, something else?

Thanks for any clarification you can provide.

Feb 21, 2012 at 10:28 AM

There isn't any locking so both requests will execute and the last result will replace any previous results. It is difficult to know if a locking solution would give you any benefits. Do you have any thoughts?

Feb 21, 2012 at 2:19 PM

I believe the current behaviour is the desired default.

A optional benefit to locking would be if you had a resource expensive action (perhaps a tough db query), you wouldn't those calls to stack up; rather, you'd want the first call's results to be sufficient for any subsequent calls that might have been waiting.