Skip to content

Commit

Permalink
feat: set read timeout and enable slot cache
Browse files Browse the repository at this point in the history
build: [release]
  • Loading branch information
lots0logs committed Jan 26, 2022
1 parent d0ac7fa commit f9a982a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public function __construct( string $name = 'default', array $redis_nodes = [] )

if ( count( $redis_nodes ) > 1 || is_string( reset( $redis_nodes ) ) ) {
// Redis Cluster
self::$_DB = new RedisCluster( null, $redis_nodes );
ini_set( 'redis.clusters.cache_slots', 1 );

self::$_DB = new RedisCluster( null, $redis_nodes, 1.5, 0 );

self::$_DB->setOption( RedisCluster::OPT_SLAVE_FAILOVER, RedisCluster::FAILOVER_DISTRIBUTE );

} else {
// Redis Standalone
throw new \ErrorException( 'Support for using redis in standalone mode is not implemented.' );
Expand Down

0 comments on commit f9a982a

Please sign in to comment.