File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ Release changes are noted on the [Releases](https://github.com/dmhendricks/wordp
5959
6060* Bumped minimum PHP version check to 5.4
6161* Added initial ` plugin.json ` for configuration
62+ * Fixed caching expiration bug
6263
6364## Credits
6465
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ class Cache extends Plugin {
1313 */
1414 public static function get_object ( $ key = null , $ callback ) {
1515
16- $ object_cache_group = isset ( self ::$ settings ['object_cache_group ' ] ) && self ::$ settings ['object_cache_group ' ] ? : sanitize_title ( self ::$ settings ['data ' ]['Name ' ] );
16+ $ object_cache_group = isset ( self ::$ settings ['object_cache ' ][ ' group ' ] ) && self ::$ settings ['object_cache ' ][ ' group ' ] ? self :: $ settings [ ' object_cache ' ][ ' group ' ] : sanitize_title ( self ::$ settings ['data ' ]['Name ' ] );
1717 if ( is_multisite () ) $ object_cache_group .= '_ ' . get_current_blog_id ();
18- $ object_cache_expire = self ::$ settings ['object_cache_expire ' ] ?: 86400 ; // Default to 24 hours of null
18+ $ object_cache_expire = ( isset ( self ::$ settings ['object_cache ' ][ ' expire_hours ' ] ) && is_int ( self :: $ settings [ ' object_cache ' ][ ' expire_hours ' ] ) ? self :: $ settings [ ' object_cache ' ][ ' expire_hours ' ] : 24 ) * 86400 ; // Default to 24 hours
1919
2020 // Set key variable
2121 $ object_cache_key = $ key . ( is_multisite () ? '_ ' . get_current_blog_id () : '' );
@@ -25,7 +25,7 @@ public static function get_object( $key = null, $callback ) {
2525 if ( $ result && is_serialized ( $ result ) ) $ result = unserialize ($ result );
2626
2727 // If result wasn't found/returned and/or caching is disabled, set & return the value from $callback
28- if (true || !$ result ) {
28+ if ( !$ result ) {
2929 $ result = $ callback ();
3030 if ( is_array ( $ result ) || is_object ( $ result ) ) $ set_result = serialize ( $ result );
3131 wp_cache_set ( $ object_cache_key , $ set_result , $ object_cache_group , $ object_cache_expire );
You can’t perform that action at this time.
0 commit comments