SlideShare a Scribd company logo
How
 I
 learned
to
 stop
 worrying
and
 love
key-based
 HTML
 
fragment
 caching
TEE PARHAM
@teeparham
Rails HTML Fragment Caching with Cache Rocket
Rails HTML Fragment Caching with Cache Rocket
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:

More Related Content

TXT
Private slideshow
TXT
KEY
The Devil and HTML5
KEY
Html5 intro
KEY
网站无障碍阅读知识
PDF
spring_jiaocheng
TXT
Test upload
Private slideshow
The Devil and HTML5
Html5 intro
网站无障碍阅读知识
spring_jiaocheng
Test upload

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
A Presentation on Artificial Intelligence
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
A comparative analysis of optical character recognition models for extracting...
Review of recent advances in non-invasive hemoglobin estimation
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Advanced methodologies resolving dimensionality complications for autism neur...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A Presentation on Artificial Intelligence
Chapter 3 Spatial Domain Image Processing.pdf
Machine learning based COVID-19 study performance prediction
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Reach Out and Touch Someone: Haptics and Empathic Computing
Ad
Ad

Rails HTML Fragment Caching with Cache Rocket