Advertisement
Guest User

default.vlc

a guest
Aug 17th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. vcl 4.0;
  2.  
  3. backend default {
  4. .host = "127.0.0.1";
  5. .port = "8081";
  6. }
  7.  
  8. sub vcl_recv {
  9. # We use a header to track req.restarts value.
  10. set req.http.X-RESTARTS = req.restarts;
  11.  
  12. # req.restart stays always 0 and thus
  13. # the condition is never true.
  14. if (req.restarts == 0) {
  15. unset req.http.X-FORCE-MISS;
  16. }
  17.  
  18. # This condition is newer true as obj.hits
  19. # in vcl_hit stays always 0.
  20. if (req.http.X-FORCE-MISS == "1") {
  21. set req.hash_always_miss = true;
  22. }
  23. }
  24.  
  25. sub vcl_hit {
  26. # We use a header to track obj.hits value.
  27. set req.http.X-OBJ-HITS = obj.hits;
  28.  
  29. # obj.hits stays always 0 and thus
  30. # the condition is never true.
  31. if (obj.hits > 2) {
  32. set req.http.X-FORCE-MISS = "1";
  33. return (restart);
  34. }
  35. }
  36.  
  37. sub vcl_deliver {
  38. # Here obj.hits increases like expected.
  39. if (obj.hits > 0) {
  40. set resp.http.X-Cache = "HIT";
  41. set resp.http.X-Cache-HITS = obj.hits;
  42. } else {
  43. set resp.http.X-Cache = "MISS";
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement