introduction to wordpress object caching

8
Introduction to Object Caching Scott Cariss Thursday, 20 June 13

Upload: l3rady

Post on 13-Jan-2015

204 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Introduction to WordPress object caching

Introduction to Object Caching

Scott Cariss

Thursday, 20 June 13

Page 2: Introduction to WordPress object caching

What is it?

• Object caching is for caching data which may be computationally expensive to regenerate. E.G. a result from a complex SQL query.

• You can have persistent and non-persistent object cache.

• Object Cache can be stored in memory (RAM), on disk or in a database.

Thursday, 20 June 13

Page 3: Introduction to WordPress object caching

Why use it?

• Speed improvement!

• Less wasteful

• Reduction in load on queried systems.

Thursday, 20 June 13

Page 4: Introduction to WordPress object caching

How to use it?• WordPress comes with non-persistent object caching out of

the box with WP_Object_Cache(). Use wp_cache_get() and wp_cache_set()

• If you want to use persistent caching then decide where you want to store your object cache, in memory is the quickest.

• Install a WordPress persistent object caching plugin. W3 Total Cache, WP File Cache and APC Object Cache to name a few.

• If coding your own plugins and themes use wp_cache_get() and wp_cache_set() to store and get data from the object cache.

Thursday, 20 June 13

Page 5: Introduction to WordPress object caching

Demo

• Show a plugin that does computational expensive queries to the database that could benefit from a persistent object cache.

• Show how to install APC object cache plugin to WordPress.

• Re show the same plugin now using a persistent object cache.

Thursday, 20 June 13

Page 6: Introduction to WordPress object caching

Not using object cache

Thursday, 20 June 13

Page 7: Introduction to WordPress object caching

Using object cache

Thursday, 20 June 13

Page 8: Introduction to WordPress object caching

Improvements

• Gone from a stats page taking ~19 seconds to get results and display to ~1 second.

Thursday, 20 June 13