asp.net mvc 4 - How do i enable cache in my RestAPI in c#? -


this employeedetailscontroller.cs

namespace empapi.controllers {     [routeprefix("")]      public class employeedetailscontroller : apicontroller     {          [httpget]          [route("employees")]          public ienumerable<employee> employees()         {          }           [httpget]         [route("details/{id}")]         public ienumerable<details> details(int id)         {         }           [httpget]         [route("teaminfo/{id}")]         public ienumerable<team> teaminfo(int id)         {          }          [httpget]         [route("detailsforteam/{id}")]         public ienumerable<details> detailsforteam(int id)         {             ;         }         [httppost]         [route("postemp")]         public void postemp([frombody] employee cs)         {          }         [httpput]         [route("putemp/{id}")]         public void putemp(int id, [frombody]employee cs)         {          }         [httpdelete]         [route("deleteemp/{id}")]         public void deleteemp(int id)         {          }      } } 

i made api has various services. suppose call api/employees,after call api/details/12 , when click goback button in browser, api/employees should not triggered. how enable cache api.please tell me steps new in webapi. in advance..

add code before controller declaration follows:

[outputcache(varybyparam = "*", duration = 0, nostore = true)] public class employeedetailscontroller : apicontroller { ... } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -