Skip to content

Reactive multiGet returns empty string on non-existing key #2402

Closed
@dittos

Description

@dittos

Reactive multiGet does not distinguish between null and empty string.

// redis: ReactiveStringRedisTemplate instance
redis.opsForValue().set("a", "").block()
val result = redis.opsForValue().multiGet(listOf("a", "nonexisting")).block()!!
println(result) // expects ["", null] but actually ["", ""]

The behavior is inconsistent with Reactive get and blocking multiGet which returns null on non-existing key.

(Tested on spring-data-redis 2.6.2)


LettuceReactiveStringCommands needs to be changed. (but it would break existing usages)

return cmd.mget(keys.toArray(new ByteBuffer[0])).map((value) -> value.getValueOrElse(EMPTY_BYTE_BUFFER))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions