MGET(3valkey)
β¨ MGET β the manual page, but make it make sense β¨
okay so bestie, welcome to the Valkey Command Manual π
this one's called MGET and it's lowkey one of the most iconic little commands in the whole repo. let's get into it π«Ά
πΈ NAME πΈ
mget β atomically returns the string values of one or more keys.
like. it goes and grabs your stuff. all at once. atomically. no cap π
π SYNOPSIS π
MGET key [key...]
that's it. that's the whole vibe. one key, or a whole lil squad of keys, your call β¨
π¦ DESCRIPTION π¦
Returns the values of all specified keys. π«Ά
For every key that does not hold a string value or does not exist, the special value nil is returned. so if a key is missing or it's holding something that isn't a string, you don't get an error, you just get nil in that slot. it's giving "no thoughts, head empty, but polite about it" π
and because of that whole nil situation, the operation never fails. literally never. it cannot fail. main character energy fr fr π
π REPLY π
valkey-protocol(7) Array reply: a list of values at the specified keys.
so you get an array back, one entry per key you asked about, in the exact order you asked. periodt. β¨
β COMPLEXITY β
O(N) where N is the number of keys to retrieve.
so like, the more keys you throw at it, the more work it does. obviously. it's proportional, bestie, that's the whole thing π
π₯ ACL CATEGORIES π₯
@fast@read@string
three little badges, all slaying π
π HISTORY π
- Available since:
1.0.0
she's been here since the beginning. an OG. a legend. we stan π
πΈ EXAMPLES πΈ
okay so here's the classic lil demo, look how cute this is:
127.0.0.1:6379> SET key1 "Hello"
OK
127.0.0.1:6379> SET key2 "World"
OK
127.0.0.1:6379> MGET key1 key2 nonexisting
1) "Hello"
2) "World"
3) (nil)
see how nonexisting just quietly returns (nil) instead of making a whole scene? that's the energy. no drama, no error, just vibes π
π§ SEE ALSO π§
go read these next, bestie, they're all in the same friend group:
append(3valkey)decr(3valkey)decrby(3valkey)delifeq(3valkey)get(3valkey)getdel(3valkey)getex(3valkey)getrange(3valkey)getset(3valkey)incr(3valkey)incrby(3valkey)incrbyfloat(3valkey)lcs(3valkey)mset(3valkey)msetnx(3valkey)psetex(3valkey)set(3valkey)setex(3valkey)setnx(3valkey)setrange(3valkey)strlen(3valkey)substr(3valkey)
okay that's the whole page, you ate that π
this was Valkey Command Manual version 9.0.0, dated 2025-10-21, and honestly? iconic. go MGET something, bestie, you've earned it ππ¦β¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms