我的緩存符合我的要求,但我希望能夠判斷我返回的返回是否實際上來自緩存。有沒有辦法看到這個?我可以訪問代碼庫進行修改。ServiceStack:如何判斷請求的返回是否被緩存?
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
});
}
}
你可以顯示緩存代碼嗎? – paqogomez