Caching

Hi,

In production mode, Radiant uses page level caching right?

Settings (environment.rb and environments/production.rb) look like page
level
caching, but I thought page level caching wrote files to the public/
directory?
I’m confused on the pages being cached as .yml in the cache/ directory?

I sincerely apologize if the answers are found someplace obvious. I’ve
tried
searching the past mailing lists and site. I’m not sure, but maybe this
is
related to:

http://dev.radiantcms.org/radiant/ticket/474

Todd

Todd McGrath wrote:

In production mode, Radiant uses page level caching right?

Settings (environment.rb and environments/production.rb) look like page level
caching, but I thought page level caching wrote files to the public/ directory?
I’m confused on the pages being cached as .yml in the cache/ directory?

Radiant uses a custom caching system built on top of the Rails caching
system (I believe that would be page level caching). Files are cached as
yaml because the entire response is cached including the headers–not
just the HTML.


John L.
http://wiseheartdesign.com

Rails caching
system (I believe that would be page level caching). Files
are cached as
yaml because the entire response is cached including the headers–not
just the HTML.

The caching in radiant is most similar to rails action caching, not page
caching. The radiant custom cache has caused a few problems
for people trying to do session-based things with radiant code, but it
significantly outperforms the rails action cache (or at
least, it does in the mental branch).

Dan.

The caching in radiant is most similar to rails action caching, not page
caching. The radiant custom cache has caused a few problems
for people trying to do session-based things with radiant code, but it
significantly outperforms the rails action cache (or at
least, it does in the mental branch).

Can I set cache options, expire_time for instance, outside of editting
the
response_cache.rb file directly?

Todd McGrath wrote:

The caching in radiant is most similar to rails action caching, not page
caching. The radiant custom cache has caused a few problems
for people trying to do session-based things with radiant code, but it
significantly outperforms the rails action cache (or at
least, it does in the mental branch).

Can I set cache options, expire_time for instance, outside of editting the
response_cache.rb file directly?

You sure can. Take a look at the environment files in
config/environments/.


John L.
http://wiseheartdesign.com

Todd McGrath wrote:

Can I set cache options, expire_time for instance, outside of editting the
response_cache.rb file directly?
You sure can. Take a look at the environment files in config/environments/.
Example to set the timeout from default of 5 to 10 minutes:
ResponseCache.defaults[:expire_time] = 600

Or:

ResponseCache.defaults[:expire_time] = 5.minutes


John L.
http://wiseheartdesign.com

Can I set cache options, expire_time for instance, outside of editting the
response_cache.rb file directly?

You sure can. Take a look at the environment files in config/environments/.

Thanks,

I think I got it? -

Example to set the timeout from default of 5 to 10 minutes:
ResponseCache.defaults[:expire_time] = 600

I’m running Radiant 0.6.0rc2

Is there any way to disable caching of Radiant generated pages AND
plugin code when running in development mode? Having to clear the page
cache after every plugin code change is slowing me down.

In order to not cache Radiant pages I had to set the following in
/config/environments/development.rb
config.cache_classes = true
ResponseCache.defaults[:perform_caching] = false

Setting the first flag to true seems odd, but I couldn’t turn off
caching any other way.

My plugin code, which injects some HTML into the page through a radiant
tag, seems to always be cached nomatter what I set config.cache_classes
to.

Any ideas?

Any ideas?

I have tried to track this bug with Aptana debugger on Windows.
I’m using Radiant 0.6.2 (gem) with WEBrick server on my development
machine.

The problem is: ResponseCache instance is not living during whole server
lifespan. It is recreated on every page request.

First time, when server is being started, ResponseCache instance is
created with right default options (:perform_caching is false as
specified in development.rb). But then happily dies.

On every consequent page request ResponseCache is created again, but
with original defaults as specified in
radiant-0.6.2/app/models/response_cache.rb.

My solution:
I ended up, modifing radiant-0.6.2/app/models/response_cache.rb on my
development machine and forcing :perform_caching to be false in
initialize call.

Caching is disabled as expected, but to see modified content of my
extension I need hit a browser refresh button two times (maybe it is
somehow connected to extension caching or rails caching). Anyway, it
works much better for me now.

That’s my $0.02. I’m a ruby, rails and radiant newbie, I may be totally
wrong.

I have tried to track this bug with Aptana debugger on Windows.
I’m using Radiant 0.6.2 (gem) with WEBrick server on my development
machine.

The problem is: ResponseCache instance is not living during
whole server
lifespan. It is recreated on every page request.

Yes, the ResponseCache instance is constantly recreated, but the
ResponseCache class isn’t being reloaded, and the defaults are
stored at the class level. (well, the class should not be reloaded, and
as far as I can tell it isn’t).

Editing the ResponseCache settings should be done like so:

ResponseCache.defaults[:perform_caching] = false
ResponseCache.defaults[:expire_time] = 10.minutes

in the development.rb file.

To test, I added a new tag in standard_tags.rb:

tag ‘response_cache_settings’ do |tag|
ResponseCache.defaults.inspect
end

included that tag on my homepage, started up the site and accessed the
page a few times - it consistently gave back the expected
values.

Dan.

David P. wrote:

I’m running Radiant 0.6.0rc2

Is there any way to disable caching of Radiant generated pages AND
plugin code when running in development mode? Having to clear the page
cache after every plugin code change is slowing me down.

In order to not cache Radiant pages I had to set the following in
/config/environments/development.rb
config.cache_classes = true
ResponseCache.defaults[:perform_caching] = false

Setting the first flag to true seems odd, but I couldn’t turn off
caching any other way.

My plugin code, which injects some HTML into the page through a radiant
tag, seems to always be cached nomatter what I set config.cache_classes
to.

Any ideas?

Now using Radiant 0.6.1 on a new project and I’m still having trouble
with disabling both class and page caching. Any way I need to
specifically setup environment/development.rb?

config.cache_classes = false

Show full error reports and caching is turned off, but ResponseCache

caching is on
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
ResponseCache.defaults[:perform_caching] = true

setting expire_time does not help at all

ResponseCache.defaults[:expire_time] = 10.seconds

Also, from the commented line above, what is the difference between
“caching” and “ResponseCache caching”?

Thanks,

  • Dave

On every consequent page request ResponseCache is created again, but
with original defaults as specified in
radiant-0.6.2/app/models/response_cache.rb.

I avoided this by adding this line to the “activate” def of a custom
extension:

ResponseCache.defaults[:perform_caching] = false