MACIEJ 
GRAJCAREK 
Chief Innovation Officer @ Da Vinci Studio 
@MaciejGrajcarek 
ZEND CERTIFIED ENGINEER 
PROFESSIONAL SCRUM MASTER I 
TDD/BDD Propagator 
DDD Explorer 
Agile Enthusiast 
WeBB MeetUp #1 
02/12/2014
WEB APPLICATIONS 
CACHING 
TECHNIQUES
DBMS AND INDEXES
POPULAR & NEW
it's all about THE speed
WHY BOTHER? 
SPEED LEADS TO PAGE RANK 
PAGE RANK LEADS TO THE NUMBER OF PAGE IMPRESSIONS 
PAGE IMPRESSIONS' NUMBER LEADS TO THE CREDITS
https://blog.kissmetrics.com/loading-time/ 
EVERY SECOND COUNTS!
THE STORY...
OUR HERO
GENIUS!
BASIC SETUP
OPCache / APC
#1 – DESTROY!
POST DEPLOY - opcache_reset()
Page speed 
CHROME ANALYZE (EX PAGE SPEED)
<IfModule mod_expires.c> 
ExpiresActive on 
ExpiresDefault "access plus 1 month" 
# CSS 
ExpiresByType text/css "access plus 1 year" 
# Media 
ExpiresByType image/png "access plus 1 day" 
ExpiresByType video/webm "access plus 1 month" 
</IfModule> 
mod_expire
#2 – RENAME
AUTOMATION!
TIME FOR A REVOLUTION
SERVES STATIC CONTENT...
…OR EVEN BETTER
DATABASE GETTING SLOWER?
KEY-VALUE CACHE
BUSINESS LOGIC
BASIC CACHE READ-WRITE
HOW WE DO IT
CONFIG
WRITE PROCESS
WRITE PROCESS
FETCH PROCESS
INVALIDATION PROCESS
WET!
A LITTLE BIT OF MAGIC
DRY AGAIN
#3 - THIS IS INVALIDATION!
HTTP PROXY CACHING
WEBPAGES ARE NOT MONOLITS
WEB PAGES ARE COMPLEX
REVERSE PROXY
EXPIRATION VS VALIDATION
DOGPILE EFFECT
OVERWRITE
BONUS
TIPS 
#1 CACHE FROM THE BEGINNING 
#2 OVERWRITE CACHE IF POSSIBLE 
#3 CACHE SMALL, REUSABLE 
ELEMENTS 
#4 BE CAREFUL WITH PRIVATE DATA 
#5 AUTOMATE!
THANK YOU! 
ANY QUESTIONS??? 
@MaciejGrajcarek mgrajcarek@davinci-studio.eu

WeBB MeetUp#1 Web applications caching techniques