Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/php/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -79,7 +80,7 @@ function are_settings_unified(): bool {
* @return array<string, array<string, mixed>>
*/
function get_settings_values(): array {
$settings = wp_cache_get( CACHE_KEY );
$settings = wp_cache_get( CACHE_KEY, CACHE_GROUP );
if ( $settings ) {
return $settings;
}
Expand All @@ -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;
}

Expand Down Expand Up @@ -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 );
}

Expand Down Expand Up @@ -306,7 +307,7 @@ function process_settings_actions( array $input ): ?array {
* @return array<string, array<string, mixed>> 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 ) ) {
Expand Down