diff --git a/INSTALLATION.md b/INSTALLATION.md index 684eb7fd..138f9aac 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -1603,7 +1603,6 @@ define( 'CONSTANT_NAME', value ); | FICTIONEER_API_STORYGRAPH_IMAGES | boolean | Whether to add image links to the Storygraph. Default `true`. | FICTIONEER_API_STORYGRAPH_HOTLINK | boolean | Whether hotlinking images from the Storygraph is allowed. Default `false`. | FICTIONEER_API_STORYGRAPH_CHAPTERS | boolean | Whether to add chapters to the Storygraph `/stories` endpoint. Default `true`. -| FICTIONEER_API_STORYGRAPH_TRANSIENTS | boolean | Whether to cache Storygraph responses as Transients. Default `true`. | FICTIONEER_ENABLE_STICKY_CARDS | boolean | Whether to allow sticky cards. Expensive. Default `true`. | FICTIONEER_ENABLE_STORY_DATA_META_CACHE | boolean | Whether to "cache" story data in a meta field. Default `true`. | FICTIONEER_ENABLE_MENU_TRANSIENTS | boolean | Whether to cache nav menus as Transients. Default `true`. diff --git a/functions.php b/functions.php index 1b52192e..89846b5d 100644 --- a/functions.php +++ b/functions.php @@ -398,11 +398,6 @@ if ( ! defined( 'FICTIONEER_API_STORYGRAPH_CHAPTERS' ) ) { define( 'FICTIONEER_API_STORYGRAPH_CHAPTERS', true ); } -// Boolean: Storygraph API Transients caching -if ( ! defined( 'FICTIONEER_API_STORYGRAPH_TRANSIENTS' ) ) { - define( 'FICTIONEER_API_STORYGRAPH_TRANSIENTS', true ); -} - // Boolean: Enable sticky cards if ( ! defined( 'FICTIONEER_ENABLE_STICKY_CARDS' ) ) { define( 'FICTIONEER_ENABLE_STICKY_CARDS', true ); diff --git a/includes/functions/_api.php b/includes/functions/_api.php index d5170998..695b0b53 100644 --- a/includes/functions/_api.php +++ b/includes/functions/_api.php @@ -310,15 +310,6 @@ if ( ! function_exists( 'fictioneer_api_request_story' ) ) { // Setup $story_id = absint( $data['id'] ); - // Return cache if still valid - if ( FICTIONEER_API_STORYGRAPH_TRANSIENTS ) { - $transient_cache = get_transient( 'fictioneer_storygraph_story_' . $story_id ); - - if ( ! empty( $transient_cache ) ) { - return rest_ensure_response( $transient_cache ); - } - } - // Graph from story node $graph = fictioneer_api_get_story_node( $story_id ); @@ -336,11 +327,6 @@ if ( ! function_exists( 'fictioneer_api_request_story' ) ) { // Request meta $graph['timestamp'] = current_time( 'U', true ); - // Cache request - if ( FICTIONEER_API_STORYGRAPH_TRANSIENTS ) { - set_transient( 'fictioneer_storygraph_story_' . $story_id, $graph, FICTIONEER_API_STORYGRAPH_CACHE_TTL ); - } - // Response return rest_ensure_response( $graph ); } @@ -388,15 +374,6 @@ if ( ! function_exists( 'fictioneer_api_request_stories' ) ) { $page = max( absint( $data['page'] ) ?? 1, 1 ); $graph = []; - // Return cache if still valid - if ( FICTIONEER_API_STORYGRAPH_TRANSIENTS ) { - $transient_cache = get_transient( 'fictioneer_storygraph_stories_' . $page ); - - if ( ! empty( $transient_cache ) ) { - return rest_ensure_response( $transient_cache ); - } - } - // Prepare query $query_args = array ( 'post_type' => 'fcn_story', @@ -465,11 +442,6 @@ if ( ! function_exists( 'fictioneer_api_request_stories' ) ) { $graph['maxPages'] = $query->max_num_pages; $graph['timestamp'] = current_time( 'U', true ); - // Cache request - if ( FICTIONEER_API_STORYGRAPH_TRANSIENTS ) { - set_transient( 'fictioneer_storygraph_stories_' . $page, $graph, FICTIONEER_API_STORYGRAPH_CACHE_TTL ); - } - return rest_ensure_response( $graph ); } } diff --git a/includes/functions/_service-caching.php b/includes/functions/_service-caching.php index 83249d84..9a8101bf 100644 --- a/includes/functions/_service-caching.php +++ b/includes/functions/_service-caching.php @@ -723,18 +723,6 @@ if ( ! function_exists( 'fictioneer_track_chapter_and_story_updates' ) ) { // Refresh cached HTML output delete_transient( 'fictioneer_story_chapter_list_html' . $story_id ); - - // Delete cached API response - if ( FICTIONEER_API_STORYGRAPH_TRANSIENTS ) { - $count_stories = wp_count_posts( 'fcn_story' ); - $pages = $count_stories->publish / FICTIONEER_API_STORYGRAPH_STORIES_PER_PAGE + 1; - - delete_transient( 'fictioneer_api_story_' . $story_id ); - - for ( $i = 1; $i <= $pages; $i++ ) { - delete_transient( 'fictioneer_storygraph_stories_' . $i ); - } - } } } }