markjaquith/WP-TLC-Transients — pull request #7 by markjaquith (2012-12-20 02:59:07+00:00)
Title: If failure in callback then transient content is wiped

Lets say my callback is:

public static function my_callback( $query ) {

$response = wp_remote_retrieve_body( wp_remote_get( $query, array( 'timeout' => 30 ) ) );

if( is_wp_error( $response ) )
return false;

return $response;
}

If the call to the remote website fails to get new content then I'm going to want to retain the existing content not blank it out. Is it possible to setup the callback that if it returns false then keep the existing content and retry after the cache limit?

Currently only way around this is to read the transient inside the callback on failure and return the transient content.