• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

###caches_pageとの違い
caches_actionはcaches_pageと似ていますが、依然としてすべてのリクエストがAction Packを通って処理されるようになっています。これは認証や他の制限をつけたいときに便利です。

###"/lists"と"/lists.xml"は別々にキャッシュされる
また、http://blog.s21g.com/listsとhttp://blog.s21g.com/lists.xmlは異なるリクエストとして処理され、別々にキャッシュされます。つまり、:action => "lists"のキャッシュが無効になったからといって、:actioin => "list", :format => ":xml"も無効になるわけではありません。

###キャッシュの無効化
expire_actionでキャッシュを無効化できます。Sweepwerを使って処理、タイミングを書く。caches.rbのサンプルを抜き出します。
rails>>
class ListSweeper < ActionController::Caching::Sweeper
observe List, Item

def after_save(record)
   list = record.is_a?(List) ? record : record.list
   expire_page(:controller => "lists", :action => %w( show public feed ), :id => list.id)
   expire_action(:controller => "lists", :action => "all")
    list.shares.each { |share| expire_page(:controller => "lists", :action => "show", :id => share.url_key) }
  end

end

class ListsController < ApplicationController
caches_action :index, :show, :public, :feed
cache_sweeper :list_sweeper, :only => [ :edit, :destroy, :share ]
end
<<--

###Refs
vendor/rails/actionpack/lib/action_controller/caching.rb
http://scottstuff.net/presentations/rails-caching/ かなり詳しい
http://www.ibm.com/developerworks/web/library/wa-rails1/
http://www.hostingrails.com/forums/rails_coding_thread/386

posted by satoko satoko on Sat 28 Jun 2008 at 01:20 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
iphone開発gitIBInterfaceBuilderiOSSIMBLSnippetsterminaltwitterxcodeXcode4
Comments rssrss
https://rootskitchen.bar/ https://rootskitchen.bar/: Just had a solid session playing the crash format ... 05/18 17:27
guest guest: Optimizar el tiempo durante un viaje de negocios e... 05/18 00:46
https://foolsandkings.bar/ https://foolsandkings.bar/: Wrapped up a cracking night session grinding crash... 05/17 19:23
guest guest: Para muchos turistas, el transporte publico y la l... 05/15 18:22
https://safeedsautotransport.com/ https://safeedsautotransport.com/: Многие пользователи в Узбекистане интересуются, на... 05/13 14:36
evlnwyiyh evlnwyiyh: something new and exciting [url=http://www.gyxb4s... 05/08 11:27
guest guest: The creative community and travel enthusiasts note... 05/07 02:59
https://www.thegameroom.org/online-casinos/100-free-spins/ https://www.thegameroom.org/online-casinos/100-free-spins/: Frisse xxx platforms brengen innovatieve inhoud vo... 05/03 11:12
Services from s21g
YOMU Web小説リーダー
小説投稿サイトの公式ページを開き、読みやすい表示、しおり、進捗保存、読み上げで読書を続けやすくするiPhoneアプリです。
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。
jotter.me
個人開発者のためのホスティング一体型ノートサービス
ハンドミラー
iPhone向けの手鏡アプリ
ツイプロ(twpro)
Twitterプロフィールの高速検索エンジン