We're busy adding support for Internet Explorer 6, but if you've been considering an upgrade you can upgrade Internet Explorer, or download Firefox for free.

Our site is best viewed on standards-compliant browsers: Firefox, Safari, Internet Explorer 7.0+, etc.

Profile

Rails Caching non HTML Files

Posted on 11/10/2006 by Adam
0 Comments

Rails page caching is without a doubt the best way to speed up your application and reduce the server load. I decided to cache some XML I was dumping out for a web service and realized that Rails will cache the document as HTML. As long as the controller handles nothing but xml you can do the following as a work-around:

class LinkApiController < ApplicationController

  session :off
  skip_before_filter :check_authorization

  LinkApiController.page_cache_extension = '.xml'
  caches_page :get_stuff

  ...
end

Tagged:  ruby, rails

Comments

Be the first to add a comment.

Post a Comment

Name

Comment

simple_captcha.jpg
Please type the letters from the image above.