Skip to content
Bluetape4k docs1.11

Commands and coroutines

Latest stable Based on Bluetape4k release 1.11.0

commands is blocking, asyncCommands returns RedisFuture, and coroutinesCommands exposes Lettuce’s experimental coroutine API. Sync calls can fit a blocking service boundary; coroutine services should remain async or suspending end to end.

val async = LettuceClients.asyncCommands(client)
val value = async.get("account:1").awaitSuspending()
val values = listOf(async.get("a"), async.get("b")).awaitAll()

awaitAll() preserves input order, returns an empty list for empty input, and propagates a failed future instead of constructing partial results.

awaitSuspending() follows kotlinx.coroutines.future.await cancellation rules. Suspended loaded maps also rethrow CancellationException. Converting cancellation into a Redis miss would invoke a database loader after the caller has already abandoned the work.

RedisCommandSupports caches COMMAND INFO per client and command and closes its temporary connection. An inspection failure returns false, so permissions and true server incompatibility may need separate operational diagnosis.

Continue with Codecs and serialization.