Top Banner
Advanced Caching Internally and Externally Anthony Burchell @thewpressguy Slides Available at: antpb.com/caching
38
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Caching WordPress - Anthony Burchell Wordcamp Presentation

Advanced Caching

Internally and

Externally

Anthony Burchell

@thewpressguy

Slides Available at: antpb.com/caching

Page 2: Caching WordPress - Anthony Burchell Wordcamp Presentation

Why should I Cache?Page load speed will keep readers on your site

Page 3: Caching WordPress - Anthony Burchell Wordcamp Presentation

Anyone watch Halt

and Catch Fire?Cardiff’s goal of building a computer with a system

response time of 396 milliseconds

can be easily translated to your webpage.

A quick response will make users

addicted to your product (your site).

Page 4: Caching WordPress - Anthony Burchell Wordcamp Presentation

Why is it slow??WordPress is making sometimes thousands of calls to

files. These files are then refering to the database to

gather content and render the page.

Page 5: Caching WordPress - Anthony Burchell Wordcamp Presentation

How do I speed it

up?There are many many ways to speed things up.

The most turn key solution would be caching.

Page 6: Caching WordPress - Anthony Burchell Wordcamp Presentation

Caching PluginsWP Supercache

WP Redis Cache

W3 Total Cache

WP Fast Cache

Page 7: Caching WordPress - Anthony Burchell Wordcamp Presentation

THEY’RE ALL

GREATBut let’s just focus on two…

WP Supercache

WP RedisCache

Page 8: Caching WordPress - Anthony Burchell Wordcamp Presentation

WP SupercacheGenerates static html files from

your dynamic WordPress blog.

Page 9: Caching WordPress - Anthony Burchell Wordcamp Presentation

Remove Pointless

ProcessingAll those php files add up to a simple

html page...why not just save that data

and display it quicker.

Page 10: Caching WordPress - Anthony Burchell Wordcamp Presentation

WP Supercache - Caching

On

Page 11: Caching WordPress - Anthony Burchell Wordcamp Presentation

WP Supercache - Advanced

Settings

Page 12: Caching WordPress - Anthony Burchell Wordcamp Presentation

WP Supercache - Advanced

Settings

Page 13: Caching WordPress - Anthony Burchell Wordcamp Presentation

Cool.

But what’s the

catch?If your content is constantly changing

static files will be displaying old content.

Page 14: Caching WordPress - Anthony Burchell Wordcamp Presentation

Two Ways

to Avoid This1.) Preload Pages

2.) Dynamic Caching

Page 15: Caching WordPress - Anthony Burchell Wordcamp Presentation

Option 1 - Preload

Page 16: Caching WordPress - Anthony Burchell Wordcamp Presentation

Preload ProblemsContent will not update with every refresh

but rather on a time interval.

Page 17: Caching WordPress - Anthony Burchell Wordcamp Presentation

Option 2

Dynamic ContentStore content to the output buffer of

and statically cache only

parts of the page.

Page 18: Caching WordPress - Anthony Burchell Wordcamp Presentation

It’s a bit confusing

but hang in there…

Page 19: Caching WordPress - Anthony Burchell Wordcamp Presentation

Let’s use the example of AdRotate

Pro

Page 20: Caching WordPress - Anthony Burchell Wordcamp Presentation

Refresh the page…

Page 21: Caching WordPress - Anthony Burchell Wordcamp Presentation

Refresh again…

Page 22: Caching WordPress - Anthony Burchell Wordcamp Presentation

AdRotate Pro

Required Code<? php adrotate_group(1); ?>

Page 23: Caching WordPress - Anthony Burchell Wordcamp Presentation

WP-Supercache has a

dynamic caching

plugin/plugins/wp-super-cache/plugins/dynamic-cache-test.php

Page 24: Caching WordPress - Anthony Burchell Wordcamp Presentation

Let’s define the string of text

WP-Supercache should look for

Page 25: Caching WordPress - Anthony Burchell Wordcamp Presentation

Let’s store the adrotate function in the

output buffer of the plugin

Page 26: Caching WordPress - Anthony Burchell Wordcamp Presentation

Awesome.

Now let’s put the string

into the theme.

Page 27: Caching WordPress - Anthony Burchell Wordcamp Presentation
Page 28: Caching WordPress - Anthony Burchell Wordcamp Presentation
Page 29: Caching WordPress - Anthony Burchell Wordcamp Presentation

What if I don’t need

dynamic caching?

MAKE IT FASTER!

Page 30: Caching WordPress - Anthony Burchell Wordcamp Presentation
Page 31: Caching WordPress - Anthony Burchell Wordcamp Presentation

What is Redis?Redis is anadvanced key-value

cache and store

i.e. It’s freakin quick.

Page 32: Caching WordPress - Anthony Burchell Wordcamp Presentation

I won’t get into the

technical details today.

But here is a step by step

video tutorial I did

configuring.

REDIS TUTORIAL

Page 33: Caching WordPress - Anthony Burchell Wordcamp Presentation

BenefitsCan serve pages from external

or internal server

as fast as .5 second

FULL RENDER

Page 34: Caching WordPress - Anthony Burchell Wordcamp Presentation

Saves a hash key value

and ties it to the html data

from the page

Page 35: Caching WordPress - Anthony Burchell Wordcamp Presentation

Also minifies css to

further

capitalize on the speed

Redis handles static

content

Page 36: Caching WordPress - Anthony Burchell Wordcamp Presentation
Page 37: Caching WordPress - Anthony Burchell Wordcamp Presentation

Q&A

Page 38: Caching WordPress - Anthony Burchell Wordcamp Presentation

Advanced Caching

Internally and

Externally

Anthony Burchell

@thewpressguy

Slides Available at: antpb.com/caching