withRedisPool

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

Executes block with this RedisClient, passing null if the connection fails.

Extension function on RedisClient. Pings the server first to verify connectivity. A pool that cannot lend a connection, and an authentication failure, both count as a connection failure.

Return

the result of block

Parameters

printStackTrace

if true, logs the full stack trace on connection failure

block

the operation to execute; receives null on connection failure

Type Parameters

T

the return type of the block