Skip to content

Commit

Permalink
MDL-63128 core_cache: Add new is_cluster_available helper
Browse files Browse the repository at this point in the history
The ::is_cluster_available() will return true if the PHP support redis cluster.
  • Loading branch information
meirzamoodle committed Mar 25, 2024
1 parent b7452d4 commit c700e4f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cache/classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,13 @@ public static function warnings(array $stores = null) {
public static function result_found($value): bool {
return $value !== false;
}

/**
* Checks whether the cluster mode is available in PHP.
*
* @return bool Return true if the PHP supports redis cluster, otherwise false.
*/
public static function is_cluster_available(): bool {
return class_exists('RedisCluster');
}
}

0 comments on commit c700e4f

Please sign in to comment.