SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
How
 I
 learned
to
 stop
 worrying
and
 love
key-based
 HTML
 
fragment
 caching
TEE PARHAM
@teeparham
1

Do
 not
 
expire
 
keys
2

Model
 
associations
govern
expiry
3

Nested
caching
is
 best
class Project
has_many :todo_lists
class TodoList
belongs_to :project, touch: true
has_many :todos
class Todo
belongs_to :todo_list, touch: true
cache_key
 todo = Todo.first
= #Todo id: 1,
updated_at: 2013-11-19 00:24:01
 todo.cache_key
= todos/1-20131119002401851149000
cache_key
 todo = Todo.first
= #Todo id: 1,
updated_at: 2013-11-19 00:24:01
 todo.cache_key
= todos/1-20131119002401851149000
Project

TodoList
Todo
view
 keys
 todo.cache_key
= todos/1-20131119002401851149000
 cache(‘todo_item’, todo)
= todo_item/todos/1-20131119002401851149000
- @projects.each do |project|
- cache [‘project’, project] do
...project...
- project.todo_lists.each do |todo_list|
- cache [‘todo_list’, todo_list] do
...todo_list...
- todo_list.todos.each do |todo|
- cache [‘todo’, todo] do
...todo...
YO
 DAWG
has_many
 
 :arrows
a
different
hammer
User*
City

User
Idea*

*
*YO
 DAWG?
.stream-item
.item-rail
.avatar-stream
= avatar(idea.user)
.mobile-meta.show-for-small
Suggested by #{user_link(idea.user)}
%br/
= l idea.created_at, format: :short_year
.item-pointer
.item-content
.bubble-stream{class: activity_class(idea)}
.item-main{class: ('has-media' if idea.has_stream_media?)}
- if idea.has_stream_media?
.stream-media
= link_to stream_image(idea), idea_path(idea)
- if idea.stream_media_video?
= link_to #9654;.html_safe, idea_path(idea)
.text
.text-body
= want_link(idea)
.sub
%span.actions
= solution_count(idea)
= me_too_link(idea)
hit
 rate?
- cache [‘stream’,
idea,
current_user] do
.all-the-codez
= me_too_link(idea)
hit
 rate
key:

Weitere ähnliche Inhalte

Ähnlich wie Rails HTML Fragment Caching with Cache Rocket

Templates81 special document
Templates81 special documentTemplates81 special document
Templates81 special documentLan Nguyen
 
Templates81 special document
Templates81 special documentTemplates81 special document
Templates81 special documentLan Nguyen
 
Ss 36932418[1]
Ss 36932418[1]Ss 36932418[1]
Ss 36932418[1]Ya Jinda
 
Doctype html public
Doctype html publicDoctype html public
Doctype html publicEddy_TKJ
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识ppanyong
 
I pv6+at+caribbean+sector
I pv6+at+caribbean+sectorI pv6+at+caribbean+sector
I pv6+at+caribbean+sectormax Firmin
 
An Introductory Look at Social Mark-Up
An Introductory Look at Social Mark-UpAn Introductory Look at Social Mark-Up
An Introductory Look at Social Mark-UpBuiltvisible
 
Espacios en-tu-vida
Espacios en-tu-vidaEspacios en-tu-vida
Espacios en-tu-vidaepacheco1
 
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!Coulawrence
 
Introduction to web components
Introduction to web componentsIntroduction to web components
Introduction to web componentsMarc Bächinger
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular UJoonas Lehtinen
 
Makroekonomi topik-8-1
Makroekonomi topik-8-1Makroekonomi topik-8-1
Makroekonomi topik-8-1020881
 
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Iasi code camp 12 october 2013   shadow dom - mihai bîrsanIasi code camp 12 october 2013   shadow dom - mihai bîrsan
Iasi code camp 12 october 2013 shadow dom - mihai bîrsanCodecamp Romania
 
Design for people, Code for computers - Jasper Moelker (18 apr 2013)
Design for people, Code for computers - Jasper Moelker (18 apr 2013)Design for people, Code for computers - Jasper Moelker (18 apr 2013)
Design for people, Code for computers - Jasper Moelker (18 apr 2013)Jasper Moelker
 
BreizhBeans - Web components
BreizhBeans - Web componentsBreizhBeans - Web components
BreizhBeans - Web componentsHoracio Gonzalez
 

Ähnlich wie Rails HTML Fragment Caching with Cache Rocket (20)

Templates81 special document
Templates81 special documentTemplates81 special document
Templates81 special document
 
Templates81 special document
Templates81 special documentTemplates81 special document
Templates81 special document
 
Ss 36932418[1]
Ss 36932418[1]Ss 36932418[1]
Ss 36932418[1]
 
Doctype html public
Doctype html publicDoctype html public
Doctype html public
 
hellowired_instructions
hellowired_instructionshellowired_instructions
hellowired_instructions
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识
 
I pv6+at+caribbean+sector
I pv6+at+caribbean+sectorI pv6+at+caribbean+sector
I pv6+at+caribbean+sector
 
An Introductory Look at Social Mark-Up
An Introductory Look at Social Mark-UpAn Introductory Look at Social Mark-Up
An Introductory Look at Social Mark-Up
 
Jackie's porfolio edited
Jackie's porfolio editedJackie's porfolio edited
Jackie's porfolio edited
 
Espacios en-tu-vida
Espacios en-tu-vidaEspacios en-tu-vida
Espacios en-tu-vida
 
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
 
Introduction to web components
Introduction to web componentsIntroduction to web components
Introduction to web components
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
 
Makroekonomi topik-8-1
Makroekonomi topik-8-1Makroekonomi topik-8-1
Makroekonomi topik-8-1
 
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Iasi code camp 12 october 2013   shadow dom - mihai bîrsanIasi code camp 12 october 2013   shadow dom - mihai bîrsan
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
 
Xxx
XxxXxx
Xxx
 
Schoology tutorial[1]
Schoology tutorial[1]Schoology tutorial[1]
Schoology tutorial[1]
 
Design for people, Code for computers - Jasper Moelker (18 apr 2013)
Design for people, Code for computers - Jasper Moelker (18 apr 2013)Design for people, Code for computers - Jasper Moelker (18 apr 2013)
Design for people, Code for computers - Jasper Moelker (18 apr 2013)
 
smoke1272528461
smoke1272528461smoke1272528461
smoke1272528461
 
BreizhBeans - Web components
BreizhBeans - Web componentsBreizhBeans - Web components
BreizhBeans - Web components
 

Kürzlich hochgeladen

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Rails HTML Fragment Caching with Cache Rocket

  • 1. How
  • 2.  I
  • 11.
  • 12.
  • 13. 1 Do
  • 14.  not
  • 21. class Project has_many :todo_lists class TodoList belongs_to :project, touch: true has_many :todos class Todo belongs_to :todo_list, touch: true
  • 22. cache_key todo = Todo.first = #Todo id: 1, updated_at: 2013-11-19 00:24:01 todo.cache_key = todos/1-20131119002401851149000
  • 23. cache_key todo = Todo.first = #Todo id: 1, updated_at: 2013-11-19 00:24:01 todo.cache_key = todos/1-20131119002401851149000
  • 25. view
  • 26.  keys todo.cache_key = todos/1-20131119002401851149000 cache(‘todo_item’, todo) = todo_item/todos/1-20131119002401851149000
  • 27. - @projects.each do |project| - cache [‘project’, project] do ...project... - project.todo_lists.each do |todo_list| - cache [‘todo_list’, todo_list] do ...todo_list... - todo_list.todos.each do |todo| - cache [‘todo’, todo] do ...todo...
  • 28. YO
  • 31.  
  • 35. *YO
  • 37. .stream-item .item-rail .avatar-stream = avatar(idea.user) .mobile-meta.show-for-small Suggested by #{user_link(idea.user)} %br/ = l idea.created_at, format: :short_year .item-pointer .item-content .bubble-stream{class: activity_class(idea)} .item-main{class: ('has-media' if idea.has_stream_media?)} - if idea.has_stream_media? .stream-media = link_to stream_image(idea), idea_path(idea) - if idea.stream_media_video? = link_to #9654;.html_safe, idea_path(idea) .text .text-body = want_link(idea) .sub %span.actions = solution_count(idea) = me_too_link(idea)
  • 38. hit
  • 39.  rate? - cache [‘stream’, idea, current_user] do .all-the-codez = me_too_link(idea)
  • 40. hit
  • 45.  1
  • 46.  /
  • 48. why
  • 49.  hit
  • 52. cache_rocket = render_cached 'stream/idea', idea: idea, replace: {me_too_link: me_too_link(idea)} stream/_idea.html.haml - cache [‘stream’, idea] do .all-the-codez = cache_replace_key :me_too_link
  • 54. div class=stream-item div class=item-rail div class=avatar-stream a href=/neighbors/abarad class=avatar-lnk data-username=abaradimg alt=Amy Barad height=65 src=https:// d30wms7jgjmff8.cloudfront.net/avatars/190/streama5e1bed52918ac859ed988618e7a2bad.jpg width=65/a /div div class=mobile-meta show-for-small Suggested by a href=/neighbors/abaradAmy Barad/abr Jun 11, 2011 /div /div div class=item-pointer/div div class=item-content div class=bubble-stream main-item div class=has-media item-main div class=stream-media a href=/ideas/nola-the-ability-to-recycle-glimg alt=image height=159 src=https://d30wms7jgjmff8.cloudfront.net/ images/107/streamf97520b5053a463e8465195222e98a07.jpg width=212/a /div div class=text div class=text-body a href=/ideas/nola-the-ability-to-recycle-gl398 neighbors want the ability to recycle glass in New Orleans./a /div div class=sub span class=actionsa href=/ideas/nola-the-ability-to-recycle-gl#actions class=btn white-border largestrong2/strong actions/a/span me_too_link form action=/votes/803 class=button_to method=post div span class=actions input name=_method type=hidden value=delete input class=btn mint large type=submit value=Undo input name=authenticity_token type=hidden value=vi66rEYBUkiqZVqss7DT/JhDbaN4GSdadEtk34ijRBg= /span /div /form /div /div /div div class=rule-mint-xlt/div div class=bubble-head new-supporters spanNew Supporters/span a href=/neighbors/brittwright class=tiny-avatar-lnkimg alt=Britt Wright height=22 src=https:// d30wms7jgjmff8.cloudfront.net/assets/avatar_medium_8.png width=22/a a href=/neighbors/rosemary class=tiny-avatar-lnkimg alt=Rosemary height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/25636/thumb0d559f628e6e05c8f32a179ba44e80a6. width=22/a a href=/neighbors/willmarshall class=tiny-avatarlnkimg alt=Will M. height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/26049/thumb2ae0e8a2760bcec545ae2655c497e2b1. width=22/a a href=/ neighbors/alex5 class=tiny-avatar-lnkimg alt=Alex height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/26707/ thumb511139a75432ee1b6dc9ad6f90b06ca2.jpg width=22/a a href=/neighbors/mike3 class=tiny-avatar-lnkimg alt=Mike height=22 src=https:// d30wms7jgjmff8.cloudfront.net/avatars/24145/thumbc9a0b03a4f25bcbb9f37de0486e4df10.png width=22/a a href=/neighbors/jaba4017 class=tiny-avatar-lnkimg alt=Bill Arceneaux height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/3891/thumb6d95461aad25696fc0b4d69a4685f2f8.jpg width=22/a a href=/ neighbors/faubourgstjohn class=tiny-avatar-lnkimg alt=Charlie London height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/203/ thumb9872b2f76cdbcd64893f8855f73129cb.jpg width=22/a a href=/neighbors/andrewjameson class=tiny-avatar-lnkimg alt=Andrew Jameson height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/25316/thumb17689e5da8b64a01fc585438679037d4.jpg width=22/a a href=/neighbors/jenaoh1 class=tiny-avatarlnkimg alt=Jena Oh height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/25255/thumb1da559a045c471284e83cfded82f6e82. width=22/a a href=/ neighbors/rosemeistr class=tiny-avatar-lnkimg alt=rosemeistr height=22 src=https://d30wms7jgjmff8.cloudfront.net/assets/avatar_medium_1.png width=22/a /div div class=bubble-unit top-shadow hide-for-small bottom span class=city-flaga href=/cities/nolaNew Orleans/a/span Suggested by a href=/neighbors/abaradAmy Barad/a on Jun 11, 2011 /div div class=progress-flag/div /div /div HTML
  • 55.  on
  • 57. div class=stream-item div class=item-rail div class=avatar-stream a href=/neighbors/abarad class=avatar-lnk data-username=abaradimg alt=Amy Barad height=65 src=https:// d30wms7jgjmff8.cloudfront.net/avatars/190/streama5e1bed52918ac859ed988618e7a2bad.jpg width=65/a /div div class=mobile-meta show-for-small Suggested by a href=/neighbors/abaradAmy Barad/abr Jun 11, 2011 /div /div div class=item-pointer/div div class=item-content div class=bubble-stream main-item div class=has-media item-main div class=stream-media a href=/ideas/nola-the-ability-to-recycle-glimg alt=image height=159 src=https:// d30wms7jgjmff8.cloudfront.net/images/107/streamf97520b5053a463e8465195222e98a07.jpg width=212/a /div div class=text div class=text-body a href=/ideas/nola-the-ability-to-recycle-gl398 neighbors want the ability to recycle glass in New Orleans./a /div div class=sub span class=actionsa href=/ideas/nola-the-ability-to-recycle-gl#actions class=btn white-border largestrong2/strong actions/a/span me_too_link cr me_too_link /div /div /div div class=rule-mint-xlt/div div class=bubble-head new-supporters spanNew Supporters/span a href=/neighbors/brittwright class=tiny-avatar-lnkimg alt=Britt Wright height=22 src=https://d30wms7jgjmff8.cloudfront.net/assets/avatar_medium_8.png width=22/a a href=/neighbors/rosemary class=tiny-avatar-lnkimg alt=Rosemary height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/25636/thumb0d559f628e6e05c8f32a179ba44e80a6. width=22/a a href=/ neighbors/willmarshall class=tiny-avatar-lnkimg alt=Will M. height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/26049/ thumb2ae0e8a2760bcec545ae2655c497e2b1. width=22/a a href=/neighbors/alex5 class=tiny-avatar-lnkimg alt=Alex height=22 src=https:// d30wms7jgjmff8.cloudfront.net/avatars/26707/thumb511139a75432ee1b6dc9ad6f90b06ca2.jpg width=22/a a href=/neighbors/mike3 class=tiny-avatarlnkimg alt=Mike height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/24145/thumbc9a0b03a4f25bcbb9f37de0486e4df10.png width=22/a a href=/neighbors/jaba4017 class=tiny-avatar-lnkimg alt=Bill Arceneaux height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/3891/ thumb6d95461aad25696fc0b4d69a4685f2f8.jpg width=22/a a href=/neighbors/faubourgstjohn class=tiny-avatar-lnkimg alt=Charlie London height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/203/thumb9872b2f76cdbcd64893f8855f73129cb.jpg width=22/a a href=/neighbors/ andrewjameson class=tiny-avatar-lnkimg alt=Andrew Jameson height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/25316/ thumb17689e5da8b64a01fc585438679037d4.jpg width=22/a a href=/neighbors/jenaoh1 class=tiny-avatar-lnkimg alt=Jena Oh height=22 src=https://d30wms7jgjmff8.cloudfront.net/avatars/25255/thumb1da559a045c471284e83cfded82f6e82. width=22/a a href=/neighbors/rosemeistr class=tiny-avatar-lnkimg alt=rosemeistr height=22 src=https://d30wms7jgjmff8.cloudfront.net/assets/avatar_medium_1.png width=22/a /div div class=bubble-unit top-shadow hide-for-small bottom span class=city-flaga href=/cities/nolaNew Orleans/a/span Suggested by a href=/neighbors/abaradAmy Barad/ a on Jun 11, 2011 /div div class=progress-flag/div /div /div /div HTML
  • 58.  in
  • 60. cache_rocket replace_key = ‘cr me_too_link’ html = ‘formdivetc.../div/form’ fragment.gsub! replace_key, html def replace_from_hash(hash) hash.each do |key, value| gsub! cache_replace_key(key), value.to_s end end
  • 61. gsub!
  • 64. render_cached 'top', replace: ['inner', ‘footer’] partials top.html.haml #here = cache_replace_key :inner #there = cache_replace_key :footer
  • 65. render_cached 'top', replace: {key: a_helper(x)} value top.html.haml = cache_replace_key :key
  • 67.  for
  • 70. def replace_item_hash(item, replace_hash) item_fragment = self.value.dup replace_hash.each do |key, proc| item_fragment.gsub! cache_replace_key(key), proc.call(item) end item_fragment end
  • 71. gsub!
  • 77.  a
  • 87.  in
  • 92.  RAM
  • 93. speed No Caching 123 ms Russian Doll* 67 ms CacheRocket 113 ms CacheRocket collection 82 ms
  • 96. Cat