Tuesday, March 17, 2015

The Complete Guide to the WordPress Transients API

WordPress has supported the Transients API since version 2.8 but still many WordPress developers are unaware of its existence and uses. In a nutshell, WordPress Transients API lets us store key-value pairs of data with an expiration time.


In this tutorial, we will cover how to use this API in depth. We will also see how it's different from Options API, how it interacts with the WordPress caching system and few of its use cases.


WordPress Transients API

Options API vs Transients API


Most WordPress developers are aware of WordPress Options API. Options API lets us store key-value pairs of data permanently in the database. What many WordPress developers don’t realise is that Options API implements a caching layer (i.e. WordPress Object Cache) to cache the options. If a persistent cache is not enabled then a new caching session is created on every HTTP request otherwise the persistent cache is used by Options API.


Continue reading %The Complete Guide to the WordPress Transients API%




by Narayan Prusty via SitePoint

No comments:

Post a Comment