OBJECT-REFCOUNT(3valkey)
β¨ OBJECT-REFCOUNT β¨ (from the valkey manual, section 3, bestie π)
okay so real talk, this one is SO simple and that's exactly why it's iconic π
π NAME π
object-refcount β literally just tells you how many references are pointing at the value stored at a key. that's it. that's the whole job. queen behavior.
π¦ SYNOPSIS π¦
OBJECT REFCOUNT key
This command returns the reference count of the stored at <key>. (yes i know, the original sentence is missing a word, i'm not gonna gaslight you and pretend it isn't β it means the reference count of the value stored at <key>. the way that grammar just gave up π)
πΈ REPLY πΈ
π RESP2
One of the following, bestie:
valkey-protocol(7)Integer reply: the number of references. π’valkey-protocol(7)Nil reply: if key doesn't exist. π
π RESP3
One of the following:
valkey-protocol(7)Integer reply: the number of references. π’valkey-protocol(7)Null reply: if key doesn't exist. π
not me pointing out that RESP2 says "Nil" and RESP3 says "Null" β yes they're two different things, and no i will not be the one to conflate them. character development π
π§ COMPLEXITY π§
O(1) β constant time, no cap. she does not care how big your keyspace is, she is NOT scrolling. main character energy only π
π ACL CATEGORIES π
@keyspace@read@slow
lowkey the @slow tag is doing the most here considering it's literally O(1), but the categories said what they said and i respect the system π«Ά
π HISTORY π
- Available since: 2.2.3 β she's an OG, been here since basically forever, a true vintage icon β¨
π SEE ALSO π
go read these too, they're all in the same friend group:
copy(3valkey)del(3valkey)dump(3valkey)exists(3valkey)expire(3valkey)expireat(3valkey)expiretime(3valkey)keys(3valkey)migrate(3valkey)move(3valkey)object(3valkey)object-encoding(3valkey)object-freq(3valkey)object-help(3valkey)object-idletime(3valkey)persist(3valkey)pexpire(3valkey)pexpireat(3valkey)pexpiretime(3valkey)pttl(3valkey)randomkey(3valkey)rename(3valkey)renamenx(3valkey)restore(3valkey)scan(3valkey)sort(3valkey)sort_ro(3valkey)touch(3valkey)ttl(3valkey)type(3valkey)unlink(3valkey)wait(3valkey)waitaof(3valkey)
and that's the whole page, we ate and left absolutely no crumbs π
β¨ this was version 9.0.0, dated 2025-10-21, brought to you by the valkey girlies. stay refcounted, stay iconic, ily π«Άππ
π¦ 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