Nesting of Commands

71 views
Skip to first unread message

Sandeep Mukhopadhyay

unread,
Mar 25, 2011, 12:05:30 PM3/25/11
to redi...@googlegroups.com
Hi All

1) Do Redis supports nesting of commands like scard sinter "ASet" "BSet" ?

2) Could we have this kind of linked data structure? below

Set1 = { "value1", "value2" , "value3", {"Set2"} }
Set2 = { "value10", "value12" , "value14", {"Set5"} }
...
Set5 = { "value20", "value21" , "value22" }

if I want to evaluate scard of Set1, then it should evaluate accordingly.

Thanks,
Sandy

Josiah Carlson

unread,
Mar 25, 2011, 2:06:55 PM3/25/11
to redi...@googlegroups.com, Sandeep Mukhopadhyay
On Fri, Mar 25, 2011 at 9:05 AM, Sandeep Mukhopadhyay
<sandee...@gmail.com> wrote:
> Hi All
> 1) Do Redis supports nesting of commands like scard sinter "ASet" "BSet" ?

No. But the intersection of sets does return the cardinality of the
resulting set already.

> 2) Could we have this kind of linked data structure? below
> Set1 = { "value1", "value2" , "value3", {"Set2"} }
> Set2 = { "value10", "value12" , "value14", {"Set5"} }
> ...
> Set5 = { "value20", "value21" , "value22" }
> if I want to evaluate scard of Set1, then it should evaluate accordingly.

This has been discussed before, and the resulting discussion basically
lead to: multi-layered data structures are not necessary or desired at
this time. Search the archives for more information.

Regards.
- Josiah

Dvir Volk

unread,
Mar 25, 2011, 2:07:31 PM3/25/11
to redi...@googlegroups.com, Sandeep Mukhopadhyay
On Fri, Mar 25, 2011 at 6:05 PM, Sandeep Mukhopadhyay <sandee...@gmail.com> wrote:
Hi All

1) Do Redis supports nesting of commands like scard sinter "ASet" "BSet" ?
yes and no...
not as you wrote it but you can do it in one roundtrip with a MULTI, storing the intersection in a destination set

MULTI
SINTERSTORE dest set1 set2
SCARD dest
EXEC

 

2) Could we have this kind of linked data structure? below

Set1 = { "value1", "value2" , "value3", {"Set2"} }
Set2 = { "value10", "value12" , "value14", {"Set5"} }
...
Set5 = { "value20", "value21" , "value22" }
 
if I want to evaluate scard of Set1, then it should evaluate accordingly.


No, you'd have to use references by key and multiple roundtrips to join them.

 
Thanks,
Sandy

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.



--
Dvir Volk
System Architect, Do@, http://doat.com

Reply all
Reply to author
Forward
0 new messages