SlideShare une entreprise Scribd logo
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:

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastUXDXConf
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsUXDXConf
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101vincent683379
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfEasyPrinterHelp
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 

Dernier (20)

What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 

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