Skip to content

Commit

Permalink
fix #1613 (multisite cache)
Browse files Browse the repository at this point in the history
  • Loading branch information
hansmorb committed Jul 11, 2024
1 parent f9c1e49 commit 2155d5d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Service/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ public static function getCacheItem( $custom_id = null ) {

/**
* Returns cache id, based on calling class, function and args.
*
* @since 2.7.2 added Plugin_Dir to Namespace to avoid conflicts on multiple instances on same server
*
* @param null $custom_id
*
* @return string
* @since 2.7.2 added Plugin_Dir to Namespace to avoid conflicts on multiple instances on same server
* @since 2.10 added support for multisite caches
*
*/
public static function getCacheId( $custom_id = null ): string {
$backtrace = debug_backtrace()[2];
$backtrace = self::sanitizeArgsArray( $backtrace );
$namespace = COMMONSBOOKING_PLUGIN_DIR;
$namespace = COMMONSBOOKING_PLUGIN_DIR; //To account for multiple instances on same server
$namespace .= '_' . get_current_blog_id(); //To account for WP Multisite
$namespace .= '_' . str_replace( '\\', '_', strtolower( $backtrace['class'] ) );
$namespace .= '_' . $backtrace['function'];
$backtraceArgs = $backtrace['args'];
Expand Down

0 comments on commit 2155d5d

Please sign in to comment.