smemhashes

Gets the contents of all the Hashes whose keys are in a Set

Returns Multi-bulk - a List of Hashes by key
Keys
  1. Set containing the keys of a series of Hashes
Args None
Caveats This script violates the EVAL command semantics and should not be considered safe for Redis Cluster.

Example

> hset aaron favorites 1
(integer) 1
> hset aaron name aaron
(integer) 1
> hset antirez favorites 10341513551
(integer) 1
> hset antirez name salvatore
(integer) 1
> sadd people aaron
(integer) 1
> sadd people antirez
(integer) 1
> evalsha 9e12b0dd0bc17be398e03d8610ae7510641353ea 1 people
1) 1) "aaron"
   2) 1) "favorites"
      2) "1"
      3) "name"
      4) "aaron"
2) 1) "antirez"
   2) 1) "favorites"
      2) "10341513551"
      3) "name"
      4) "salvatore"

Source

local keys = redis.call("smembers", KEYS[1])
local ret = {}
for k,v in pairs(keys) do
  ret[k] = {v, redis.call("hgetall", v)}
end
return ret

SHA

9e12b0dd0bc17be398e03d8610ae7510641353ea

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.