はい。
奇妙なのは、キャッシュされるはずなのに、そうでないと信じる理由がないことです。
$categories = get_transient( 'wpdc_discourse_categories' );
if ( ! empty( $options['publish-category-update'] ) || ! $categories ) {
$body = $this->discourse_request( '/site.json' );
if ( is_wp_error( $body ) ) {
return $body;
}
if ( $body->categories ) {
// removed for brevity
// Note that setting the cache to 0 will disable transient expiration.
$category_cache_period = apply_filters( 'wpdc_category_cache_minutes', 10 );
set_transient( 'wpdc_discourse_categories', $discourse_categories, intval( $category_cache_period ) * MINUTE_IN_SECONDS );
return $discourse_categories;
} else {
return new \WP_Error( 'key_not_found', 'The categories key was not found in the response from Discourse.' );
}
}
編集:トランジェントをリストアップすると、タイムスタンプが5分後にあるキー timeout_wpdc_discourse_categories はありますが、wpdc_discourse_categories がありません:thinking:
編集2:set_transient( 'wpdc_discourse_categories', $discourse_categories, intval( $category_cache_period ) * MINUTE_IN_SECONDS ); が false を返しています。$discourse_categories は正しく設定されています。他のトランジェントは機能しています。