withSuspendingRedis

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

Suspending variant of withRedis. Creates a short-lived connection, executes a suspending block, and closes it.

Passes null to block if the connection fails.

Return

the result of block

Parameters

redisUrl

the Redis connection URL

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