在開發時,使用 partial 是相當簡潔以及迅速的做法。但這會帶來一個壞處。造成相當多的 db query 以及 render :partial 這個行為帶來的 slow down。 解法是,在 controller 下 find all 時,順便下 :include ,把相關的 model 都拉一拉回來。 至於 partial 這部份,就使用 fragment cache 的做法,把 html 丟進 memcache ..XD。時間到 expire 掉。 這樣噴頁面速度就會相當快。 目前我使用的是 Handcache + MonetaMoneta supports 相當多的 backend * File store for xattr * Basic File Store * Memcache store * In-memory store * The xattrs in a file system * DataMapper * S3 * Berkeley DB * Redis * SDBM * Tokyo * CouchDB
文章標籤
全站熱搜
創作者介紹
創作者 rails 的頭像
rails

Always on Rails

rails 發表在 痞客邦 留言(0) 人氣(0)