> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shiftlabs.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Key Browser

> Browse, create, and manage Redis keys with full CRUD operations

The Redis Key Browser provides a visual interface for managing Redis keys. Browse keys in a tree structure, view and edit values, and perform bulk operations across your Redis databases.

## Key Concepts

<CardGroup cols={2}>
  <Card title="Key" icon="key">
    A unique identifier that stores data. Keys can hold different data types like strings, lists, or hashes.
  </Card>

  <Card title="TTL" icon="clock">
    Time-To-Live in seconds. Keys can expire automatically after a set duration.
  </Card>

  <Card title="Namespace" icon="folder-tree">
    Keys are often organized using colons (e.g., `user:123:profile`). The browser displays these as folders.
  </Card>

  <Card title="Pattern" icon="asterisk">
    Wildcard expressions to match multiple keys (e.g., `cache:*` matches all cache keys).
  </Card>
</CardGroup>

## Required Permissions

| Action      | Permission                                |
| ----------- | ----------------------------------------- |
| View keys   | `iam:project:infrastructure:redis:read`   |
| Create keys | `iam:project:infrastructure:redis:write`  |
| Update keys | `iam:project:infrastructure:redis:write`  |
| Delete keys | `iam:project:infrastructure:redis:delete` |

## Supported Key Types

| Type           | Description                            | Use Case                      |
| -------------- | -------------------------------------- | ----------------------------- |
| **String**     | Simple key-value pair                  | Caching, counters, flags      |
| **List**       | Ordered sequence of strings            | Queues, recent items, feeds   |
| **Set**        | Unordered collection of unique strings | Tags, unique visitors         |
| **Sorted Set** | Set with score-based ordering          | Leaderboards, priority queues |
| **Hash**       | Field-value map                        | Objects, user profiles        |
| **Stream**     | Append-only log                        | Event sourcing, messaging     |

## How to Browse Keys

<Steps>
  <Step title="Select Connection">
    Choose a Redis connection from the dropdown.
  </Step>

  <Step title="Select Database">
    Choose the database number (0-15 by default).
  </Step>

  <Step title="Navigate Tree">
    Click folders to expand namespaces. Keys with colons are grouped into folders.
  </Step>

  <Step title="Select Key">
    Click on a key to view its details in the right panel.
  </Step>
</Steps>

<Info>
  Your connection and database selections are saved. The browser will restore your last view on next visit.
</Info>

## How to Create a Key

<Steps>
  <Step title="Click Add Key">
    Click the **Add Key** button in the header.
  </Step>

  <Step title="Choose Creation Method">
    Select a method:

    * **Templates**: Pre-configured key templates for common patterns
    * **Manual**: Build the key from scratch
    * **Import**: Paste JSON data to create a key
  </Step>

  <Step title="Enter Key Name">
    Provide a unique key name. Use colons for namespacing (e.g., `cache:user:123`).
  </Step>

  <Step title="Select Data Type">
    Choose the appropriate type: String, List, Set, Sorted Set, or Hash.
  </Step>

  <Step title="Enter Value">
    Add the value based on the selected type.
  </Step>

  <Step title="Set TTL (Optional)">
    Choose an expiration time or leave as "No Expiry".
  </Step>

  <Step title="Create">
    Click **Create Key** to save the new key.
  </Step>
</Steps>

### Key Name Rules

| Rule                   | Description                                         |
| ---------------------- | --------------------------------------------------- |
| **Length**             | 1-512 characters                                    |
| **Spaces**             | Not allowed in key names                            |
| **Special Characters** | Most characters allowed, use colons for namespacing |

<Tip>
  Use consistent naming patterns like `{entity}:{id}:{attribute}` for easier organization. Example: `user:123:sessions`.
</Tip>

## How to View Key Details

<Steps>
  <Step title="Select a Key">
    Click on any key in the tree or list view.
  </Step>

  <Step title="View Details">
    The right panel shows key information including type, TTL, encoding, and size.
  </Step>

  <Step title="View Value">
    The value is displayed with appropriate formatting for the key type.
  </Step>
</Steps>

## How to Edit a String Key

<Steps>
  <Step title="Select the Key">
    Click on a string key to view its details.
  </Step>

  <Step title="Edit Value">
    Modify the value in the editor.
  </Step>

  <Step title="Save">
    Click **Save** to update the value.
  </Step>
</Steps>

## How to Edit a Hash Key

<Steps>
  <Step title="Select the Hash">
    Click on a hash key to view its fields.
  </Step>

  <Step title="Edit Field">
    Click on a field to edit its value inline.
  </Step>

  <Step title="Add Field">
    Click **Add Field** to add a new field-value pair.
  </Step>

  <Step title="Delete Field">
    Click the delete icon to remove a specific field.
  </Step>
</Steps>

## How to Edit a List Key

<Steps>
  <Step title="Select the List">
    Click on a list key to view its items.
  </Step>

  <Step title="Push Item">
    Use **Push Left** or **Push Right** to add items to the list.
  </Step>

  <Step title="Edit Item">
    Click on an item to edit its value at that index.
  </Step>

  <Step title="Remove Item">
    Click the delete icon to remove an item by value.
  </Step>
</Steps>

## How to Edit a Set Key

<Steps>
  <Step title="Select the Set">
    Click on a set key to view its members.
  </Step>

  <Step title="Add Member">
    Click **Add Member** and enter a value.
  </Step>

  <Step title="Remove Member">
    Click the delete icon next to a member to remove it.
  </Step>
</Steps>

## How to Edit a Sorted Set Key

<Steps>
  <Step title="Select the Sorted Set">
    Click on a sorted set key to view members with their scores.
  </Step>

  <Step title="Add Member">
    Click **Add Member**, enter a value and score.
  </Step>

  <Step title="Remove Member">
    Click the delete icon next to a member to remove it.
  </Step>
</Steps>

## How to Rename a Key

<Steps>
  <Step title="Select the Key">
    Click on the key to open its details.
  </Step>

  <Step title="Click Rename">
    Click the **Rename** button in the toolbar.
  </Step>

  <Step title="Enter New Name">
    Provide the new key name.
  </Step>

  <Step title="Confirm">
    Click **Rename** to apply the change.
  </Step>
</Steps>

<Warning>
  Renaming a key will overwrite any existing key with the new name.
</Warning>

## How to Set TTL

<Steps>
  <Step title="Select the Key">
    Click on the key to open its details.
  </Step>

  <Step title="Click Set TTL">
    Click the **TTL** button in the toolbar.
  </Step>

  <Step title="Choose Duration">
    Select a preset duration or enter a custom value in seconds.
  </Step>

  <Step title="Apply">
    Click **Update TTL** to set the expiration.
  </Step>
</Steps>

### TTL Options

| Option    | Duration               |
| --------- | ---------------------- |
| No Expiry | Key never expires      |
| 1 minute  | 60 seconds             |
| 5 minutes | 300 seconds            |
| 1 hour    | 3600 seconds           |
| 1 day     | 86400 seconds          |
| 1 week    | 604800 seconds         |
| Custom    | Enter seconds manually |

<Info>
  Set TTL to -1 to remove expiration from a key.
</Info>

## How to Delete a Key

<Steps>
  <Step title="Select the Key">
    Click on the key to open its details.
  </Step>

  <Step title="Click Delete">
    Click the **Delete** button.
  </Step>

  <Step title="Confirm">
    Confirm the deletion. This action cannot be undone.
  </Step>
</Steps>

## How to Bulk Delete Keys

Bulk delete allows you to remove multiple keys matching a pattern.

<Steps>
  <Step title="Click Bulk Delete">
    Click the **Bulk Delete** button in the header.
  </Step>

  <Step title="Choose Method">
    Select a method:

    * **Quick Actions**: Pre-defined cleanup patterns
    * **Pattern**: Enter a custom wildcard pattern
  </Step>

  <Step title="Enter Pattern">
    Use wildcard patterns to match keys:

    * `cache:*` matches all keys starting with `cache:`
    * `*:temp` matches all keys ending with `:temp`
    * `session:*:data` matches keys with this pattern
  </Step>

  <Step title="Preview Matches">
    Review the list of keys that will be deleted.
  </Step>

  <Step title="Select Keys">
    Check or uncheck keys to include/exclude from deletion.
  </Step>

  <Step title="Type Confirmation">
    Type "DELETE" to confirm the operation.
  </Step>

  <Step title="Execute">
    Click **Confirm Delete** to proceed.
  </Step>
</Steps>

<Warning>
  Bulk delete is permanent. Always preview matched keys before confirming deletion.
</Warning>

### Pattern Syntax

| Pattern          | Matches                     |
| ---------------- | --------------------------- |
| `*`              | All keys (use with caution) |
| `cache:*`        | Keys starting with `cache:` |
| `*:temp`         | Keys ending with `:temp`    |
| `user:*:session` | Keys matching the pattern   |
| `?`              | Single character wildcard   |

## How to Delete Selected Keys from Tree

<Steps>
  <Step title="Select Multiple Keys">
    Use checkboxes in the key tree to select multiple keys.
  </Step>

  <Step title="Click Delete Selected">
    Click the delete button that appears when keys are selected.
  </Step>

  <Step title="Confirm">
    Confirm the deletion of selected keys.
  </Step>
</Steps>

## Key Templates

When creating keys, templates provide pre-configured structures:

| Template     | Type       | Use Case          |
| ------------ | ---------- | ----------------- |
| Cache Entry  | String     | General caching   |
| Session Data | Hash       | User sessions     |
| Task Queue   | List       | Background jobs   |
| Rate Limiter | String     | API rate limiting |
| Feature Flag | String     | Feature toggles   |
| Leaderboard  | Sorted Set | Rankings          |

## Troubleshooting

<AccordionGroup>
  <Accordion title="Key not appearing after creation" icon="circle-question">
    * Click the refresh button to reload the key list
    * Verify you're viewing the correct database
    * Check if the key has a very short TTL and expired
  </Accordion>

  <Accordion title="Cannot edit key value" icon="circle-question">
    * You need write permission
    * The key type may not support the operation
    * Check if another process is modifying the key
  </Accordion>

  <Accordion title="Key shows wrong type" icon="circle-question">
    * Redis keys have a fixed type once created
    * To change type, delete and recreate the key
    * Verify you're looking at the correct key
  </Accordion>

  <Accordion title="Bulk delete matched too many keys" icon="circle-question">
    * Always preview matches before deleting
    * Use more specific patterns
    * Use the checkbox selection to exclude keys
  </Accordion>

  <Accordion title="Cannot delete key" icon="circle-question">
    * You need delete permission
    * The key may have been deleted by another process
    * Check for connection issues
  </Accordion>

  <Accordion title="Key value appears truncated" icon="circle-question">
    * Very large values may be truncated in the UI
    * Use Redis CLI for viewing complete large values
    * Lists and sets are paginated
  </Accordion>
</AccordionGroup>

## FAQ

<AccordionGroup>
  <Accordion title="What is the maximum key size?">
    Redis allows key names up to 512 MB, but shorter keys are recommended for performance. Keep key names under 1 KB and use meaningful but concise naming.
  </Accordion>

  <Accordion title="What is the maximum value size?">
    String values can be up to 512 MB. Lists, sets, and hashes can contain over 4 billion elements. Practical limits depend on available memory.
  </Accordion>

  <Accordion title="Can I search for keys by value?">
    Redis does not support value-based search natively. Keys are found by name pattern only. Consider using a search index or naming convention for lookups.
  </Accordion>

  <Accordion title="What happens when TTL expires?">
    Redis automatically deletes the key when TTL reaches zero. Active expiration occurs during access; passive expiration runs periodically.
  </Accordion>

  <Accordion title="Can I copy a key to another database?">
    Not directly in the UI. Use Redis CLI with `COPY` command (Redis 6.2+) or `DUMP`/`RESTORE` for cross-database key copying.
  </Accordion>

  <Accordion title="What is key encoding?">
    Redis uses different internal encodings for efficiency (e.g., ziplist, quicklist, hashtable). Encoding changes automatically based on data size.
  </Accordion>

  <Accordion title="How are keys organized in the tree?">
    Keys are split by colon (`:`) separator to create a folder hierarchy. `user:123:profile` appears under user > 123 > profile.
  </Accordion>

  <Accordion title="What's the difference between List push left vs right?">
    Push left (`LPUSH`) adds to the beginning; push right (`RPUSH`) adds to the end. Use left for stack behavior, right for queue behavior.
  </Accordion>
</AccordionGroup>

## Best Practices

### Naming Conventions

Use consistent, hierarchical naming:

```
{entity}:{id}:{attribute}

Examples:
user:123:profile
cache:api:endpoint
session:abc123:data
rate:192.168.1.1:minute
```

### TTL Management

* Always set TTL on cache keys to prevent unbounded growth
* Use appropriate durations: sessions (hours), cache (minutes to days)
* Monitor keys without TTL to prevent memory issues

### Key Organization

* Keep namespaces shallow (2-3 levels)
* Use consistent separators (colon recommended)
* Avoid spaces and special characters in key names
* Consider key length impact on memory

### Bulk Operations

* Always preview before bulk delete
* Use specific patterns to avoid accidental deletions
* Test patterns on non-production databases first
* Consider impact on running applications
