You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ValuesController.cs 951B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections.Generic;
  2. using System.Web.Http;
  3. namespace CacheControl_test.Controllers
  4. {
  5. public class ValuesController : ApiController
  6. {
  7. // GET api/values
  8. // Ignore all parameters
  9. [MyCacheOutput(30, true, true)]
  10. public IEnumerable<string> Get()
  11. {
  12. return new string[] { "value1", "value2" };
  13. }
  14. // GET api/values/5
  15. // Ignore post
  16. [MyCacheOutput(30, false, true)]
  17. public string Get(int id)
  18. {
  19. return "get value";
  20. }
  21. // POST api/values
  22. // Ignore get
  23. [MyCacheOutput(30, true)]
  24. public string Post([FromBody]IEnumerable<int> value)
  25. {
  26. return "post value";
  27. }
  28. // PUT api/values/5
  29. // cache all
  30. [MyCacheOutput(30)]
  31. public string Put([FromUri]int id, [FromBody]string value)
  32. {
  33. return "put";
  34. }
  35. }
  36. }