When a key is opened for writing, RedisModule_OpenKey() will return an handle even if the key does not exist, since the key will be created if the key is targeted by a writing command (otherwise if the key is opened just for reading, NULL is returned).

In such a case should the APIs for reading handle this case gracefully? Like, opening a key for writing and then performing an HashGet() API call, should probably behave exactly as if the hash item does not exist.

Thanks to @sklivvz for signaling the issue.

Comment From: dvirsky

How about following the philosophy of file creation? I.e. you can open a key for reading and writing, and opening for writing can have a create-if-not-exists flag. If this flag is not specified, opening a non existing key for writing will fail. If it does, then it is assumed the user knows what they are doing and it's safe to assume they will not try to read from an empty key.

Comment From: yossigo

Looks like we're too far in the game to change that now.