ActiveRecord::Base#to_xmlをキャッシュ
to_xmlが遅いので適当に作ってみた。developmentモードではキャッシュ無効。
ただし
インストール
script/plugin install http://taslam-plugins.googlecode.com/svn/trunk/acts_as_xmlcaching/
設定
# config/environment.rb memcache_options = { :compression => false, :debug => false, :namespace => "foo-#{ENV['RAILS_ENV']}", :readonly => false, :urlencode => false } memcache_servers = [ '192.168.0.1:11211' ] ActiveRecord::XmlCaching.servers = memcache_servers ActiveRecord::XmlCaching.options = memcache_options ActiveRecord::XmlCaching.prefix = :application_name
モデルに追記
class Entry < ActiveRecord::Base # もし#to_xmlをオーバーライド等してたら、そこより後に書く acts_as_xmlcaching end