I know there are lost of related questions already posted on this subject, but none of them seem to solve my problem, so here is another one.
I have an MVC project which has a controller that is used for returning JSON strings in response to AJAX lookups.
An example of this is a city lookup (type-ahead) - if the user types "Lon" into the search box, an AJAX call is made to the controller that returns a JSON string of all cities starting with "Lon".
There aren't that many entries in our application, and it's relatively static information, so I'd like to output-cache the results of each request (inc. query string parameters), e.g.:
http://abc.com/lookup/city?q=lon
I would expect to be able to set up output caching to store the output for a period of time (using URL / query string as the keys) - so that a single client requesting this should receive a 200 and the content on the first request, and then a 304 for subsequent identical requests. i.e. so that it looks like a static file.
If it's being served out of the IIS output cache I wouldn't expect it to hit the ASP.NET application at all whilst it's in cache. However, logging suggests this is not happening.
Can anyone help with this - I'm sure it's something really obvious, I just don't know what it is.