withSuspendingRedisPool

suspend fun <T> RedisClient.withSuspendingRedisPool(printStackTrace: Boolean = false, block: suspend (RedisClient?) -> T): T

Suspending variant of withRedisPool. Executes a suspending block with this RedisClient, passing null if the connection fails.

The connectivity ping runs on Dispatchers.IO. block runs in the caller's context, so Jedis calls made in it still block their thread; wrap them in withContext(Dispatchers.IO) when calling from a limited dispatcher.

Extension function on RedisClient.

Return

the result of block

Parameters

printStackTrace

if true, logs the full stack trace on connection failure

block

the suspending operation to execute; receives null on connection failure

Type Parameters

T

the return type of the block