$query_args =
array_filter( $query_args );
$transient_key =
$this->
get_transient_key( $query_args );
/*
* Use network-wide transient to improve performance. The locale is the only site
* configuration that affects the response, and it's included in the transient key.
*/
$raw_patterns =
get_site_transient( $transient_key );
if ( !
$raw_patterns ) { $api_url = 'http://api.wordpress.org/patterns/1.0/?' .
build_query( $query_args );
if ( wp_http_supports( array
( 'ssl'
) ) ) { $api_url =
set_url_scheme( $api_url, 'https'
);
} /*
* Default to a short TTL, to mitigate cache stampedes on high-traffic sites.
* This assumes that most errors will be short-lived, e.g., packet loss that causes the
* first request to fail, but a follow-up one will succeed. The value should be high
* enough to avoid stampedes, but low enough to not interfere with users manually
* re-trying a failed request.
*/