sismembermulti

Check for membership in any number of sets.

Returns 1 if the key is found, 0 if not
Keys
  1. 1 or more Sets to check for membership
Args
  1. Value to search for

Example

> sadd users alice bob
(integer) 2
> sadd admin jenny
(integer) 1
> evalsha d7550c872f553141096d5134c027af5eeed283db 2 users admin alice
(integer) 1
> evalsha d7550c872f553141096d5134c027af5eeed283db 3 users admin guests jenny
(integer) 1
> evalsha d7550c872f553141096d5134c027af5eeed283db 2 users admin abner
(integer) 0

Source

-- Is an item in any of several sets? Call with:
-- EVALSHA  n set1 set2 ... setn key
for i=1,#KEYS do
  if redis.call('sismember', KEYS[i], ARGV[1]) == 1 then
    return 1
  end
end
return 0

SHA

d7550c872f553141096d5134c027af5eeed283db

Explore Your Redis Memory Usage with an Interactive Map

RedisMonitor from RedisGreen shows you large keys, memory leaks, old keys, and other potential problems quickly. Try it now, no credit card required!

Last updated 30 Jul 2014.

← More scripts from the RedisGreen Library

License

All scripts on this site are in the public domain, unless otherwise noted, and are provided without warranty express or implied. RedisGreen make no claim for the effectiveness, safety, security or quality of the scripts contained within.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.