diff --git a/gatherpress.php b/gatherpress.php index 4f039fe97..b5c9df735 100644 --- a/gatherpress.php +++ b/gatherpress.php @@ -22,7 +22,7 @@ defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore // Constants. -define( 'GATHERPRESS_CACHE', 'gatherpress_cache' ); +define( 'GATHERPRESS_CACHE_GROUP', 'gatherpress_cache' ); define( 'GATHERPRESS_CORE_FILE', __FILE__ ); define( 'GATHERPRESS_CORE_PATH', __DIR__ ); define( 'GATHERPRESS_CORE_URL', plugin_dir_url( __FILE__ ) ); diff --git a/includes/core/classes/class-rsvp.php b/includes/core/classes/class-rsvp.php index 14fea7d12..80de2772e 100644 --- a/includes/core/classes/class-rsvp.php +++ b/includes/core/classes/class-rsvp.php @@ -277,7 +277,7 @@ public function save( int $user_id, string $status, int $anonymous = 0, int $gue 'anonymous' => intval( $anonymous ), ); - wp_cache_delete( sprintf( self::CACHE_KEY, $post_id ), GATHERPRESS_CACHE ); + wp_cache_delete( sprintf( self::CACHE_KEY, $post_id ), GATHERPRESS_CACHE_GROUP ); if ( ! $limit_reached ) { $this->check_waiting_list(); @@ -383,7 +383,7 @@ public function attending_limit_reached( array $current_response, int $guests = public function responses(): array { $post_id = $this->event->ID; $cache_key = sprintf( self::CACHE_KEY, $post_id ); - $retval = wp_cache_get( $cache_key, GATHERPRESS_CACHE ); + $retval = wp_cache_get( $cache_key, GATHERPRESS_CACHE_GROUP ); $rsvp_query = Rsvp_Query::get_instance(); // @todo add testing with cache. @@ -496,7 +496,7 @@ static function ( $response ) use ( $status ) { $retval[ $status ]['count'] = count( $retval[ $status ]['responses'] ) + $guests; } - wp_cache_set( $cache_key, $retval, GATHERPRESS_CACHE, 15 * MINUTE_IN_SECONDS ); + wp_cache_set( $cache_key, $retval, GATHERPRESS_CACHE_GROUP, 15 * MINUTE_IN_SECONDS ); return $retval; } diff --git a/test/unit/php/includes/core/classes/class-test-rsvp.php b/test/unit/php/includes/core/classes/class-test-rsvp.php index b95c8400c..a77078d02 100644 --- a/test/unit/php/includes/core/classes/class-test-rsvp.php +++ b/test/unit/php/includes/core/classes/class-test-rsvp.php @@ -266,7 +266,7 @@ public function test_responses(): void { wp_delete_user( $user_id_2 ); // User will remain while cached until it expires. - wp_cache_delete( sprintf( Rsvp::CACHE_KEY, $post->ID ), GATHERPRESS_CACHE ); + wp_cache_delete( sprintf( Rsvp::CACHE_KEY, $post->ID ), GATHERPRESS_CACHE_GROUP ); $responses = $rsvp->responses();