diff --git a/src/php/settings/settings.php b/src/php/settings/settings.php index 249bdc24..4d906483 100644 --- a/src/php/settings/settings.php +++ b/src/php/settings/settings.php @@ -11,6 +11,7 @@ use Code_Snippets\Welcome_API; use function Code_Snippets\clean_snippets_cache; use function Code_Snippets\code_snippets; +use const Code_Snippets\CACHE_GROUP; const CACHE_KEY = 'code_snippets_settings'; const OPTION_GROUP = 'code-snippets'; @@ -79,7 +80,7 @@ function are_settings_unified(): bool { * @return array> */ function get_settings_values(): array { - $settings = wp_cache_get( CACHE_KEY ); + $settings = wp_cache_get( CACHE_KEY, CACHE_GROUP ); if ( $settings ) { return $settings; } @@ -93,7 +94,7 @@ function get_settings_values(): array { } } - wp_cache_set( CACHE_KEY, $settings ); + wp_cache_set( CACHE_KEY, $settings, CACHE_GROUP ); return $settings; } @@ -125,7 +126,7 @@ function update_setting( string $section, string $field, $new_value ): bool { $settings[ $section ][ $field ] = $new_value; - wp_cache_set( CACHE_KEY, $settings ); + wp_cache_set( CACHE_KEY, $settings, CACHE_GROUP ); return update_self_option( are_settings_unified(), OPTION_NAME, $settings ); } @@ -306,7 +307,7 @@ function process_settings_actions( array $input ): ?array { * @return array> The validated settings. */ function sanitize_settings( array $input ): array { - wp_cache_delete( CACHE_KEY ); + wp_cache_delete( CACHE_KEY, CACHE_GROUP ); $result = process_settings_actions( $input ); if ( ! is_null( $result ) ) {