spring-projects / spring-data-redis

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-redis/
Apache License 2.0
1.72k stars 1.14k forks source link

how to set jedis blockingSocketTimeoutMillis? #2738

Open yunduankaifa opened 8 months ago

yunduankaifa commented 8 months ago

in our project, we need to use lua script, but the default timeoutmillis is 0, which means to block forever; image Question : how to set blockingSocketTimeoutMillis in spring-data-redis?

mp911de commented 8 months ago

There's no mechanism to alter DefaultJedisClientConfig (implementing JedisClientConfig).

JedisClientConfig carries a lot of per-connection details such as the database or authentication credentials that conflict with Spring Data Redis' RedisConfiguration types that define authentication and database details.

Out of curiosity, why don't you use the Lettuce driver that has a configuration of TimeoutSource to supply timeouts on a per-command basis where you could define a timeout specific to your Lua command?

yunduankaifa commented 8 months ago

There's no mechanism to alter DefaultJedisClientConfig (implementing JedisClientConfig).

JedisClientConfig carries a lot of per-connection details such as the database or authentication credentials that conflict with Spring Data Redis' RedisConfiguration types that define authentication and database details.

Out of curiosity, why don't you use the Lettuce driver that has a configuration of TimeoutSource to supply timeouts on a per-command basis where you could define a timeout specific to your Lua command?

since the issue (https://github.com/lettuce-io/lettuce-core/issues/2082) of lettuce has not been well solved, to be on the safe side, we choose jedis

tjuchniewicz commented 3 months ago

Mechanism to customize JedisClientConfig is also required to provide custom credentialsProvider required for implementing cloud identity based authentication.