> ## Documentation Index
> Fetch the complete documentation index at: https://cache-pot.thatdevguy.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Cache-Pot connection and server commands reference

> Reference for Cache-Pot's connection and server commands: PING, ECHO, AUTH, SELECT, QUIT, COMMAND, INFO, DBSIZE, FLUSHDB, and FLUSHALL.

These commands manage your connection to Cache-Pot and query server-level information. They follow standard Redis conventions, so any Redis-compatible client can connect and interact with Cache-Pot without modification.

***

### PING

Tests that the connection is alive. Use it to verify that Cache-Pot is reachable before issuing other commands.

**Syntax:** `PING [message]`

<ParamField query="message" type="string">
  Optional string to echo back. When omitted, the server returns `PONG`.
</ParamField>

```redis theme={null}
PING         # PONG
PING hello   # hello
```

**Returns:** The simple string `PONG`, or the provided message as a bulk string.

***

### ECHO

Echoes a message back to the client. Useful for debugging connection pipelines and round-trip latency measurements.

**Syntax:** `ECHO message`

<ParamField query="message" type="string" required>
  The string to return.
</ParamField>

```redis theme={null}
ECHO "hello world"   # hello world
```

**Returns:** The provided message as a bulk string.

***

### AUTH

Authenticates your connection with the server password. You must send `AUTH` as the first command after connecting when Cache-Pot is started with the `--auth` flag.

**Syntax:** `AUTH password`

<ParamField query="password" type="string" required>
  The password configured via the `--auth` startup flag.
</ParamField>

```redis theme={null}
AUTH mysecretpassword   # OK
```

**Returns:** `OK` on success. Returns `WRONGPASS invalid username-password pair` if the password is incorrect, or an error if no password is configured on the server.

<Warning>
  If Cache-Pot was **not** started with `--auth`, sending `AUTH` returns an error: `ERR Client sent AUTH, but no password is set`.
</Warning>

***

### SELECT

Selects the active database by index. Cache-Pot is single-database in this release, so only index `0` is accepted.

**Syntax:** `SELECT index`

<ParamField query="index" type="integer" required>
  The database index to select. Must be `0`.
</ParamField>

```redis theme={null}
SELECT 0   # OK
SELECT 1   # ERR DB index is out of range (Cache-Pot V1 supports DB 0 only)
```

**Returns:** `OK` for index `0`; an error for any other value.

***

### QUIT

Closes the current client connection gracefully. The server sends a final `OK` reply before tearing down the connection.

**Syntax:** `QUIT`

```redis theme={null}
QUIT   # OK (connection closed)
```

**Returns:** `OK`, then closes the TCP connection.

***

### COMMAND

Returns information about the commands registered in Cache-Pot. The `COUNT` subcommand is the most useful variant and is what most Redis clients issue automatically on first connect.

**Syntax:** `COMMAND [COUNT]`

<ParamField query="COUNT" type="subcommand">
  When provided, returns the total number of registered commands as an integer.
</ParamField>

```redis theme={null}
COMMAND COUNT   # (integer) <number of commands>
```

**Returns:** An integer (command count) when `COUNT` is specified; an empty array otherwise.

<Note>
  `COMMAND` is implemented as a compatibility stub. Clients that issue `COMMAND DOCS` on startup (such as newer versions of `redis-cli`) receive an empty array and fall back to normal operation.
</Note>

***

### INFO

Returns a bulk string containing server information and statistics, grouped into sections.

**Syntax:** `INFO`

```redis theme={null}
INFO
# Example output:
# Server
# cache-pot_version:0.1.0
# go_version:go1.22.0
# uptime_in_seconds:3612
#
# Clients
# connected_clients:4
# total_connections_received:109
#
# Persistence
# aof_enabled:1
#
# Keyspace
# db0:keys=1024
#
# Stats
# total_commands_processed:8801
# semantic_cache_hits:214
# semantic_cache_misses:36
# semantic_cache_hit_ratio:0.8559
```

**Returns:** A bulk string with the following sections: `Server`, `Clients`, `Persistence`, `Keyspace`, and `Stats`. The `Stats` section includes semantic cache hit and miss counters and the running hit ratio.

***

### DBSIZE

Returns the number of live (non-expired) keys in the current database.

**Syntax:** `DBSIZE`

```redis theme={null}
DBSIZE   # (integer) 42
```

**Returns:** An integer count of keys.

***

### FLUSHDB

Deletes every key in the current database immediately and synchronously.

**Syntax:** `FLUSHDB`

```redis theme={null}
FLUSHDB   # OK
```

**Returns:** `OK`.

<Warning>
  `FLUSHDB` is irreversible. All keys — including vector collections and semantic cache entries — are permanently deleted. There is no undo. Take a snapshot with `SAVE` first if you need a recovery point.
</Warning>

***

### FLUSHALL

Behaves identically to `FLUSHDB`. Because Cache-Pot is a single-database server, `FLUSHALL` and `FLUSHDB` delete the same keyspace.

**Syntax:** `FLUSHALL`

```redis theme={null}
FLUSHALL   # OK
```

**Returns:** `OK`.

<Note>
  Both `FLUSHDB` and `FLUSHALL` are provided so that any Redis client or migration script that calls either command works without modification.
</Note>
