withNonNullRedis

fun <T> withNonNullRedis(redisUrl: String = defaultRedisUrl, printStackTrace: Boolean = false, block: (RedisClient) -> T): T?

Creates a short-lived RedisClient connection, executes block with a non-null client, and closes it.

Returns null if the connection fails.

Return

the result of block, or null on connection failure

Parameters

redisUrl

the Redis connection URL

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