This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pb_get_news() { | |
/* | |
* Get transient and if expired refresh data immediately | |
*/ | |
if ( false === ( $news = get_transient( 'pb_bbc_news' ) ) ) { | |
// Uses BBC News API to fetch new data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Background Caching with Transients | |
* Using BBC News API as an example | |
*/ | |
function pb_get_news() { | |
/* | |
* Get transient and if expired refresh data immediately |
NewerOlder