# OBJECT

> Inspect how a key's value is stored and how it is accessed.

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

```
OBJECT ENCODING key
OBJECT FREQ key
OBJECT IDLETIME key
OBJECT REFCOUNT key
OBJECT HELP
```

- Group: Keys
- HotKV Cloud: all plans
- On-Premise: no license needed

`OBJECT` is a container for subcommands that report on a single key. Every
subcommand except `HELP` replies with nil when the key does not exist.

| Subcommand | What it returns |
| --- | --- |
| [OBJECT ENCODING](https://docs.hotkv.com/commands/object-encoding/index.md) | The encoding name of the value |
| [OBJECT FREQ](https://docs.hotkv.com/commands/object-freq/index.md) | The access frequency counter (LFU eviction policies only) |
| [OBJECT IDLETIME](https://docs.hotkv.com/commands/object-idletime/index.md) | Seconds since the key was last accessed (non-LFU policies only) |
| [OBJECT REFCOUNT](https://docs.hotkv.com/commands/object-refcount/index.md) | Always `1` |
| `OBJECT HELP` | A list of the subcommands with a short description of each |

An unknown subcommand replies with
`ERR unknown subcommand '<name>'. Try OBJECT HELP.`, and a subcommand with the
wrong number of arguments with
`ERR wrong number of arguments for 'object|<subcommand>' command`.

## Examples

```
127.0.0.1:6379> SET counter 42
OK
127.0.0.1:6379> OBJECT ENCODING counter
"int"
127.0.0.1:6379> OBJECT REFCOUNT counter
(integer) 1
```

## Compatibility

The same subcommands as Redis 7 and Valkey 8.

## See also

[TYPE](https://docs.hotkv.com/commands/type/index.md), [DEBUG](https://docs.hotkv.com/commands/debug/index.md),
[MEMORY USAGE](https://docs.hotkv.com/commands/memory-usage/index.md)