# Render Key Value

*Render Key Value* provides low-latency in-memory storage that's ideal for shared caches and job queues. Key Value instances are compatible with virtually all clients that interact with Redis®<sup>\*</sup>.

Paid Key Value instances include [disk-backed persistence](#data-persistence).

## Underlying libraries

- Newly created Render Key Value instances run Valkey 8.

*What is Valkey?*

[Valkey](https://valkey.io/) is an open-source key-value store that began as a fork of Redis version 7.2.4. For most libraries and frameworks that connect to a Redis instance, Valkey is a drop-in replacement.

  Learn more in the [FAQ](valkey-faq).

- Legacy Key Value instances (created before Feburary 12, 2025) run Redis 6.
  - Legacy instances no longer receive version updates, but they will continue to operate as usual.

## Quickstarts

These Render quickstarts include steps for provisioning a Key Value instance:

- [Deploy a Celery background worker](deploy-celery)
- [Deploy Rails with Sidekiq](deploy-rails-sidekiq)
- [Rails caching with Redis](rails-caching-redis)
- [Connecting to Render Key Value with ioredis](connecting-to-redis-with-ioredis)

## Create your Key Value instance

1. Go to [dashboard.render.com/new/redis](https://dashboard.render.com/new/redis), or select *New > Key Value* in the Render Dashboard.

   This form appears:

   [img]

2. Provide a helpful *Name* for your instance.
   - You can change this value at any time.
3. Choose a *Region* to run your instance in.
   - Choose the same region as your services that will connect to the instance. This minimizes latency and enables communication over your [private network](private-network).
4. Optionally change the instance's *Maxmemory Policy*.
   - [See details below.](#maxmemory-policy)
5. Scroll down and select an *instance type*. This determines its available RAM and connection limit.

> [Learn about Free instance type limitations.](free#free-key-value)

   [img]

6. Click *Create Key Value*.

You're all set! Your new instance's status updates to *Available* in the Render Dashboard when it's ready to use.

## Connect to your Key Value instance

Every Key Value instance has two different URLs for incoming connections:

- An *internal URL* for connections from your other Render services running in the _same region_
  - Connections using the internal URL are unauthenticated by default. You can optionally [require authentication for internal connections](#requiring-auth-for-internal-connections).
- An *external URL* for connections from _everything else_
  - Before you can use the external URL, you must first [enable external connections](#enabling-external-connections) for your Key Value instance.

[diagram]

*Use the internal URL wherever possible.* It minimizes latency by enabling communication over your [private network](private-network).

Both URLs are available from the *Connect* menu in the top-right corner of your instance's page in the [Render Dashboard][dboard]:

[img]

Key Value instances use `redis://` and `rediss://` URL schemes. You can connect to your instance using any Redis-compatible client that supports these schemes.

### Internal connection examples

> To connect with your internal URL, your Key Value instance and your connecting service must belong to the same workspace _and_ run in the same [region](regions).

**ioredis (JS)**

```js
import Redis from 'ioredis'

// Connect to your Key Value instance using the REDIS_URL environment variable
// The REDIS_URL is set to the internal connection URL e.g. redis://red-343245ndffg023:6379
const redis = new Redis(process.env.REDIS_URL)

// Set and retrieve some values
await redis.set('key', 'ioredis')
const result = await redis.get('key')
console.log(result)
```

**node-redis (JS)**

```js
import { createClient } from 'redis'

// Connect to your Key Value instance using the REDIS_URL environment variable
// The REDIS_URL is set to the internal connection URL e.g. redis://red-343245ndffg023:6379
const client = createClient({ url: process.env.REDIS_URL })
await client.connect()

// Set and retrieve some values
await client.set('key', 'node redis')
const value = await client.get('key')
console.log(value)
```

**redis-py (Python)**

```python
import os
import redis