Can Redis Module load meta data before loading DB?

26 views
Skip to first unread message

sewe...@gmail.com

unread,
May 24, 2022, 10:14:39 PMMay 24
to Redis DB
Background:

I'm developing a Redis Module, which create a new data structure, i.e. native type support. This new data structure needs some meta data, e.g. type schema, for serializing and deserializing.

The meta data is non-trivial, and can be shared with many objects. So I don't want to save the meta for each object of this type. Instead, I only want to save a meta id for each object. In this case, I need to load meta data before loading DB, so that when loading RDB file, I can use the meta id to look up the corresponding meta, and do serializing work.

Problem:

I don't find any Module API to save meta data for Redis Module, so that I can load it before loading DB. Correct me if I'm wrong.

Current Solution:

It looks like the only way to pass some options when loading Redis Module is the command line argument, i.e. `int argc, char **argc`. However, when the meta info is non-trivial, it's inconvenient.  And I have to save these meta data at some other storage, i.e. local file on disk, and pass the storage location as argument when initializing Redis Module.

This solution is not elegant, since I have to maintain two storages, one for meta, and one for Redis database.

I'm wondering if there's some mechanism I can save both meta and database into Redis, and load meta before loading DB?

Thanks & Regards
Reply all
Reply to author
Forward
0 new messages