Advanced Use of WordPress Cache.
In this speech I've shown many different caching mechanism provided by WordPress and how to make good use of them.
You'll learn how to make a website resiliant,more performant and more profitable.
Talk @ WordCamp Turin 2019
======================
Sapevi che WordPress dispone già di un meccanismo di caching nativo e che ha molteplici utilizzi?
In questo speech mostrerò come utilizzare i diversi meccanismi di caching offerti da WordPress per rendere un sito resiliente e performante anche in condizioni di altro traffico e in grado di generare maggiori profitti.
Talk tenuto durante il WordCamp Torino 2019
3. TABLE OF
CONTENTS
1. QUICK INTRODUCTION
2. WHY
3. USE CASE
4. WP_OBJECT_CACHE
5. CASE STUDY
6. PAY ATTENTION
7. QUESTION TIME
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
4. In computing, a cache (/kæʃ/ kash,[1] )
is a hardware or software component
that stores data so that future requests
for that data can be served faster;
the data stored in a cache might be the
result of an earlier computation or a
copy of data stored elsewhere
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
https://en.wikipedia.org/wiki/Cache_(computing)
5. 4 KIND
OF CACHE
1. OPCACHE
2. BROWSER CACHE
3. PAGE CACHE
4. OBJECT CACHE
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
15. WHEN
5 TYPICAL USE CASE
1. HIGH TRAFFIC
2. CONCURRENT ACCESS
3. DYNAMIC CONTENT
4. TIME CONSUMING
OPERATIONS
5. CPU EXPENSIVE
OPERATIONS
6. (...)
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
16. HOW MANY OF YOU ARE USING
WORDPRESS CACHE?
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
17. YOU ARE ALREADY USING CACHE
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
18. wp_cache_*
One function to rule them all
get_post_ meta
get_user_meta
get_term_meta
get_site_meta
get_metadata($object_type,
$object_id, $key, $single
);
wp_cache_get()
$wp_object_cache->get(
$key,...)
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
20. WP OBJECT
CACHE
1. SINCE 2005
2. BASE CLASS TO
PROVIDE LAYER FOR
CACHE
3. VOLATILE / NON
PERSISTENT
(BY DEFAULT)
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
https://codex.wordpress.org/Class_Reference/WP_Object_Cache
21. CASE STUDY
tourism website
● DYNAMIC COUNTERS
(OFFERS, PHOTOS,
REVIEWS)
● DYNAMIC PRODUCT
LIST
(SEARCH FILTERS)
● NO PAGINATION / NO
INFINITE SCROLL
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
22.
23. Test Page Load Queries
no cache 5,3 2400
no cache +
get_post_meta
2,5 1212
cache + get_post_meta 0,7 99
FRAGMENT CACHING 0,227 188
27. FRAGMENT
CACHING
● USEFUL TO STORE
PIECES (FRAGMENTS)
OF PAGE
● NOT AVAILABLE OUT
OF THE BOX
● PERFORMANCE HUGE
IMPROVEMENTS
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
34. I’M HIRING
● WP DEV
● WOOCOMMERCE DEV
● WEB PERFORMANCE
ADDICTED
● REMOTE WORKING
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn
https://www.performize.it/jobs/
35. PLUGINS
● SG Optimizer
● WP Redis
● WP Memcached
● Hyper DB
Wordcamp Torino - 6 Aprile 2019 - @andreacardinali - #wctrn