Following our conversation: Sometimes a data structure can't be trivially recreated from user commands. In these cases, we want to allow the module author to just use the RDB serialization callback to serialize the object, and then use RESTORE to recreate it.

The proposed solution: If the rewrite AOF callback in the data type definition is NULL, we use RESTORE and the RDB representation of the key instead.

Comment From: antirez

Related to https://github.com/antirez/redis/pull/3383

Comment From: yossigo

Closing because as mentioned, #3383 makes it possible to leverage rdb_save and rdb_load callbacks to and from strings so modules can implement their own RESTORE command.

Comment From: oranagra

@yossigo don't you think it would be nice to do that automatically in redis? another option is that if there's a single module with registered data type that didn't implement the AOFRW callback, redis automatically falls back to doing a preamble RDB format (actually that's the default nowadays).

Comment From: yossigo

@oranagra I thought about it, but it's really a small effort on the module side and I think I'd rather have modules choose to do that explicitly.

We may want to refuse to load a module with no aof_rewrite callback if preamble is disabled and refuse to disable preamble if such modules are loaded.