我的请求中连接了缓存,但我希望能够判断我返回的返回是否实际上来自缓存。有没有办法看到这个?我可以访问代码库进行修改。
ServiceStack 的标准缓存模式:
public class OrdersService : Service
{
public object Get(CachedOrders request)
{
var cacheKey = "unique_key_for_this_request";
return base.RequestContext.ToOptimizedResultUsingCache(base.Cache,cacheKey,()=>
{
//Delegate is executed if item doesn't exist in cache
//Any response DTO returned here will be cached automatically
});
}
}