usingPrepare

open fun <R> usingPrepare(key: String, value: V, then: (Boolean) -> Mono<R>): Mono<R>

Executes an operation within a prepare context with permanent value.

This method provides transaction-like semantics: it prepares a key, executes the provided operation, and automatically rolls back the preparation if the operation fails.

Return

A Mono with the operation result, with automatic rollback on failure

Parameters

R

The return type of the operation

key

The key to prepare for the operation

value

The permanent value to prepare

then

A function that receives the preparation result and returns a Mono with the operation

See also

(String, PreparedValue, (Boolean) -> Mono) for TTL support


open fun <R> usingPrepare(key: String, value: PreparedValue<V>, then: (Boolean) -> Mono<R>): Mono<R>

Executes an operation within a prepare context with optional TTL.

This method provides transaction-like semantics for key preparation. If the key preparation succeeds and the subsequent operation fails, the preparation is automatically rolled back. This ensures consistency and prevents resource leaks.

Return

A Mono with the operation result, with automatic rollback on failure

Parameters

R

The return type of the operation

key

The key to prepare for the operation

value

The prepared value with optional TTL

then

A function that receives the preparation result (true/false) and returns a Mono with the operation to execute

Throws

if the operation fails after successful preparation (rollback attempted)