RedisUtils
Factory methods and extension functions for creating and using Redis connections via Jedis.
Pool sizing and wait time can be configured via system properties or method parameters. The default Redis URL is read from the REDIS_URL environment variable.
A URL without a port uses 6379. A URL that can never work (one that is malformed, has no host, or carries a non-numeric database index or an unknown protocol) is a configuration error: every function that takes a URL throws IllegalArgumentException for it, rather than treating it as a connection failure.
Properties
System property key for the maximum number of idle connections.
System property key for the maximum connection pool size.
System property key for the maximum wait time (in seconds) when borrowing a connection.
System property key for the minimum number of idle connections.
Pool size meaning "no limit", as defined by commons-pool2.
Functions
Creates a new pooled RedisClient with the given configuration.
Suspending variant of withNonNullRedis. Creates a short-lived connection, executes a suspending block, and closes it. Returns null if the connection fails. Connecting, pinging and closing run on Dispatchers.IO; block runs in the caller's context.
Suspending variant of withNonNullRedisPool. Executes a suspending block with this RedisClient, returning null if the connection fails.
Suspending variant of withRedisPool. Executes a suspending block with this RedisClient, passing null if the connection fails.