carmelo arena
carmelo arena

Reputation: 561

llen of multiple elements

with PHP, I am getting text in this form:

 key1,key2,keyn

I am then transforming this text into an array. Now, what I am trying to do is for each of this key, get its list lenght. I know I can do a foreach with a "llen" command inside, but is it possible to do it with just one query?

Also, more generally, is this usually possible to do with other DBs, like mySQL OR mongo? Is a simple "or" statement not too heavy if the values to search against are too many?

Thanks in advance.

Upvotes: 1

Views: 230

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230336

No, there's not "multi-llen" command. Do it in the loop.

If you pipeline all LLEN commands, it's gonna be almost as fast as a single LLEN, because you don't need to wait for a reply for each LLEN. Beware, though, that your redis client might not support getting results of pipelined commands.

Upvotes: 1

Related Questions