Reputation: 5143
Should it be possible to cache server responses to services calls done via Gateway.Send() from within another service?
I've seen you comments stating that if I enable caching with [CacheResponse] attribute it should work.
However, it isn't caching the response for me. I'm using ServiceStack v5.1.0
Thanks
Upvotes: 1
Views: 371
Reputation: 143284
ServiceStack caching features only caches HTTP Requests which are serialized in the registered Cache provider and written directly to the Response Output Stream.
In Process Service Gateway requests are never serialized, cached or written to a Stream, they're effectively an in-process C# method call when calling an internal Service, if the gateway request is routed to a remote Service that's cached it will return the cached response as per normal HTTP request.
Otherwise if you want to cache an In Memory Service Gateway request you can use a ConcurrentDictionary in your Service implementation and memoize results as you would when caching any expensive C# logic.
Upvotes: 2