withNonNullRedisPool

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

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

Extension function on RedisClient. Unlike withRedisPool, the block receives a non-null client, and the entire function returns null on connection failure.

Return

the result of block, or null on connection failure

Parameters

printStackTrace

if true, logs the full stack trace on connection failure

block

the operation to execute with a guaranteed non-null client

Type Parameters

T

the return type of the block