And I also see that the sheets extension doesn't consult the "cache?"
method of the StylesheetPage (or JavascriptPage) so that's why going
down that road that didn't work either.
I'm going to submit a pull request for that.
Wes
On 6/5/11 8:57 PM, Wes Gamble wrote:
OK, so I looked into the sheets extension that is now bundled by
default with Radiant, and I see where the default cache timeout for
sheets is set to 30 days.
I attempted to modify it alongside the standard page cache timeout
like so:
config.after_initialize do
SiteController.cache_timeout = 1.second
SiteController.sheet_cache_timeout = 1.second
end
but this generates a
undefined method `sheet_cache_timeout=' for SiteController:Class
(NoMethodError)
error. I'm guessing this is because the sheets extension hasn't being
activated yet.
Where would I take advantage of resetting the
SiteController.sheet_cache_timeout setting?
Wes
On 6/5/11 6:46 PM, Wes Gamble wrote:
I need to allow a Radiant user to edit stylesheets and immediately
see the results in generated pages, which means I want to effectively
turn off caching for stylesheets.
I have set the cache timeout to 1 second in environment.rb (for some
reason, setting it to 0 doesn't work in Chrome - great ;]), like so:
config.after_initialize do
SiteController.cache_timeout = 1.second
end
and regular pages show this response header
1.
Cache-Control:
max-age=1, public
But for a stylesheet request, I keep seeing a response header of
1.
Cache-Control:
max-age=2592000, public
which is effectively 30 days.
Stylesheets are served through the SiteController like anything else
- so I don't understand why they don't appear to be subject to the
same caching controls as everything else?
Should stylesheets obey the normal page caching rules?
(I have also tried overriding the "cache?" method of StylesheetPage
to no avail, FYI).
Thanks,
Wes