Reputation: 35884
Suppose I wanted to store a hash
containing an array
:
{:foo=>[:bar, :baz], :quack => 'duck'}
At first glance I have 2 options.
:foo
and store it it as a string
. set
, store a hash
with the key
of the set
, and rebuild my data structure with 2 queries, for the set
and the hash
respectively. The second approach feels messy to me, especially considering the possibility of a hash
or multiple hash
'es being nested within the array
and the work involved rebuilding that structure upon retrieval.
What is the best approach for storing complex data structures with redis
?
Is there a better option then the options I've listed that would allow me to take advantage of redis
data types?
Upvotes: 2
Views: 84
Reputation: 304127
If you are not sharing the data with other objects, you should just go ahead and serialise them.
...As long as they are under 512MB
Upvotes: 1