Set¶
commonly used commands
sadd key val [val ...]: add values and return the number of values added that weren't already presentsrem key val [val ...]: remove values and return the number of values that were removedsismember key val: return whether the value is in the setscard key: return number of values in the setsmembers key: rturns all values as a Python setsrandmember key [count]: return one or more random values. positive count: distinct randomly chosen values; negative count: randomly chosen values may not be distinctspop key: remove and return a random valuesmove srs-key dest-key val: if value exists, remove it from source and add it to destination, return True if the value was moved
sets manipulation commands
sdiff key [key ...]: return values in first SET but not in any of the other SETssdiffstore dest-key key [key ...]: store at dest-key the values in first SET but not in any of the other SETssinter key [key ...]: return values in all of the SETssinterstore dest-key key [key ...]: store at dest-key the values in all of the SETssunion key [key ...]: return values in at least one of the SETssunionstore dest-key key [key ...]: stores at dest-key the values in at least one of the SETs