introduction to wordpress object caching

Post on 13-Jan-2015

204 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Introduction to Object Caching

Scott Cariss

Thursday, 20 June 13

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

Why use it?

• Speed improvement!

• Less wasteful

• Reduction in load on queried systems.

Thursday, 20 June 13

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

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

Not using object cache

Thursday, 20 June 13

Using object cache

Thursday, 20 June 13

Improvements

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

Thursday, 20 June 13

top related