I am using ToOptimizedResultUsingCache()
as guided by the https://github.com/ServiceStack/ServiceStack/wiki/Caching page.
My goal is (for any of my REST resources) to cache a GET
request for some period (say 30secs) and then, if necessary remove the cached response for that GET
request whenever there is a PUT
or DELETE
for that same resource.
Looks like I can do all of that with just ToOptimizedResultUsingCache()
and the wiki page guidance, which is great for saving computation for our resources.
However, I also wanted to help support basic HTTP caching of our services, by leveraging both ‘Expiration’ and ‘Validation’ patterns (nicely explained here: http://2ndscale.com/rtomayko/2008/things-caches-do) by returning the correct HTTP headers for any reverse-Proxy servers we deploy later at scale.
In particular, by supporting decorating our responses with these HTTP headers: Cache-Control
, Expires
, and LastModified
, ETag
, If-Modified-Since
and If-None_Match
. All our responses are HTTPS, which are by default not cached by HTTP cache intermediaries.
Is there any help in ServiceStack for adding these HTTP response headers when using ToOptimizedResultUsingCache()
. Or is there a recommended way of adding these headers using the information that is already cached by ToOptimizedResultUsingCache()
?
Or am I on my own here, in terms of adding these headers manually in my service? (I know how to add headers, and response filters etc, this is more of a question of what are the right hooks when using ToOptimizedResultUsingCache()
?