perl - How can I set the Cache-Control header for every response in Catalyst? -


It seems that the catalyst does not output by default cache-control: , etc. Header I know that I can output them to a given control method:

  $ c-> feedback-> headers-> Final_dated (time); $ C- & gt; Feedback-> header-> Ends (time + $ self-> cache_time}); $ C- & gt; Feedback-> header-> Header (cache_trol = & gt; "public, maximum-age = $ self-> gt; {cache_time}");  

It was very painful, though, by all means! What I like:

  • A default group of headers (now finished, now has been modified last time, cash-control: no-cache, programmable: no-cache) < / Li>
  • Override one method, per-line, default.

Is this a good way to accomplish this?

Dorobert:

Great question I did for a catalyst Advent calendar at one Covered.

Actually you create a stash variable that defines your cache time for the given operation, and then you process it in the root route routine. See the article for all the details.

JK


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -