Skip to content

Commit b78dded

Browse files
committed
Changed to flushing only cache group, rather than entire cache
1 parent 072611e commit b78dded

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

app/Settings/Network_Settings_Page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public function create_network_options_page() {
4343
}
4444

4545
/**
46-
* Logic that is run when settings are saved.
46+
* Callback when settings are saved
4747
*/
4848
public function options_saved_hook() {
4949

50-
// Clear the cache so that new settings are loaded
51-
self::$cache->flush();
50+
// Flush the plugin group cache
51+
self::$cache->flush_group();
5252

5353
}
5454

app/Settings/Settings_Page.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
class Settings_Page extends Plugin {
1515

16-
protected $settings_containers;
16+
private $settings_containers;
1717

1818
public function __construct() {
1919

@@ -28,7 +28,7 @@ public function __construct() {
2828

2929
// Register uninstall hook to delete settings
3030
if( $this->get_carbon_plugin_option( 'uninstall_remove_settings' ) ) {
31-
register_uninstall_hook( self::$config->get( 'plugin/identifier' ), array( $this, 'plugin_settings_uninstall' ) );
31+
register_uninstall_hook( self::$config->get( 'plugin/identifier' ), array( __CLASS__, 'plugin_settings_uninstall' ) );
3232
}
3333

3434
}
@@ -146,7 +146,7 @@ private function create_single_options_page() {
146146
*
147147
* @since 0.3.0
148148
*/
149-
public function plugin_settings_uninstall() {
149+
public static function plugin_settings_uninstall() {
150150

151151
foreach( $this->settings_containers as $container ) {
152152

@@ -159,12 +159,12 @@ public function plugin_settings_uninstall() {
159159
}
160160

161161
/**
162-
* Logic that is run when settings are saved.
162+
* Callback when settings are saved
163163
*/
164164
public function options_saved_hook() {
165165

166-
// Clear the cache so that new settings are loaded
167-
self::$cache->flush();
166+
// Flush the plugin group cache
167+
self::$cache->flush_group();
168168

169169
}
170170

app/Settings/WPSAC_Page.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ function __construct() {
3636
*/
3737
public function wpsac_admin_init() {
3838

39-
// Flush cache when settings saved
40-
if( isset( $_POST['option_page'] ) && $_POST['option_page'] == $this->prefix( $this->section_id ) ) self::$cache->flush();
39+
// Flush cache group when settings saved
40+
if( isset( $_POST['option_page'] ) && $_POST['option_page'] == $this->prefix( $this->section_id ) ) self::$cache->flush_group();
4141

4242
$this->settings_api->set_sections( $this->get_settings_sections() );
4343
$this->settings_api->set_fields( $this->get_settings_fields() );

0 commit comments

Comments
 (0)