# OBJECT REFCOUNT

> Return the reference count of a key's value, which is always 1.

URL: https://docs.hotkv.com/commands/object-refcount/

```
OBJECT REFCOUNT key
```

- Group: Keys
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`OBJECT REFCOUNT` exists for compatibility with tools that call it. The reply for an
existing key is always `1`.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The key exists | Integer `1` | Integer `1` |
| The key does not exist | Nil bulk string | Null |

## Examples

```
127.0.0.1:6379> SET answer 42
OK
127.0.0.1:6379> OBJECT REFCOUNT answer
(integer) 1
127.0.0.1:6379> OBJECT REFCOUNT missing
(nil)
```

## Compatibility

HotKV always replies `1` for an existing key.

## See also

[OBJECT](https://docs.hotkv.com/commands/object/index.md), [OBJECT ENCODING](https://docs.hotkv.com/commands/object-encoding/index.md)