Skip to content

Commit

Permalink
📝 docs(ObjectCache.php): update @SInCE tag to have proper indentation…
Browse files Browse the repository at this point in the history
… and spacing for consistency

🐛 fix(ObjectCache.php): fix typo in comment, change "underneath" to "underlying" for clarity
🐛 fix(ObjectCache.php): fix indentation issue in the invalidate_group() method
✨ feat(ObjectCache.php): add support for flushing cache group using wp_cache_flush_group() function
  • Loading branch information
nurul-umbhiya committed Oct 25, 2023
1 parent 1043fed commit 21e9fcf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions includes/Traits/ObjectCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Handles Caching underneath functionalities with the help of this Cacheable trait.
*
* @since 3.3.2
* @since 3.3.2
*
* @package WeDevs\Dokan\Abstracts\Traits
*/
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function delete( $key, $group = '', $time = 0 ) {
if ( empty( $key ) ) {
return false;
}

return wp_cache_delete( $key, $group, $time );
}

Expand All @@ -143,24 +143,29 @@ public static function delete( $key, $group = '', $time = 0 ) {
*
* @since 3.3.2
*
* @param string $group Group of cache to clear.
* @param string $group Group of caches to clear.
*
* @return bool
*/
public static function invalidate_group( $group ) {
$group = static::get_cache_group_with_prefix( $group );

$supported = wp_cache_supports( 'flush_group' );
if ( $supported ) {
wp_cache_flush_group( $group . '_prefix' );
}

return wp_cache_set( $group . '_prefix', static::get_time_prefix(), $group );
}

/**
* Get Cache Key and Group with Prefix added.
*
* @param string $key
* @param string $group
*
* @since 3.3.2
*
* @param string $key
* @param string $group
*
* @return array
*/
private static function get_key_and_group( $key, $group ) {
Expand Down

0 comments on commit 21e9fcf

Please sign in to comment.