So I'm using redis cache in my c# webapi and being able to implement a similar hierarchy would make my life much easier (something like this:
a-> key1
b-> c ->key2
key3
d ->...
)
My other option is to make a tree like approach with keys where a would give me 2 other keys one for key and another for b and so one (but would be a mess)
If you use redis commander to view your cache, you can use keys separated with colons,e.g, set1:subset:subset:key. Its not really a hierarchy but it displays like folders in the commander view.
Redis supports multiple datatypes. For your case you can use a Hashes
since a hash can have another nested hash in it.
Since Redis doesn't support nested data structure, you can store it this way by storing the inner hash reference in outer hash which will have difficulty while retrieving the data back. Else, you can create the hierarchical object structure as a JSON (Or, if you already have one) and store that serialized object in Redis.
See Storing nested objects in Redis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With