CDNShark Documentation

Valkey Cache

← Back to Documentation

Connect to Your Valkey Cache

  1. In the control panel open Valkey Cache.
  2. Add the IP address of every server that will connect (see Allow Your Servers to Connect). Until you do, nothing can connect.
  3. Click Access details on the cache to see its host, port and password.
SettingValue
HostThe cache's IP address
Port6379
Usernamedefault (or leave it empty)
PasswordFrom Access details
URL formredis://:PASSWORD@HOST:6379/0

Examples

# command line
valkey-cli -h HOST -p 6379 -a PASSWORD ping      # or redis-cli

# Python (redis-py)
import redis, os
r = redis.Redis(host=os.environ["CACHE_HOST"], port=6379, password=os.environ["CACHE_PASSWORD"])
r.set("greeting", "hello", ex=300)

# PHP (Laravel .env)
REDIS_HOST=HOST
REDIS_PASSWORD=PASSWORD
REDIS_PORT=6379

What your user can do

All normal commands work, including CONFIG GET and FLUSHDB. Administrative commands (changing the server configuration, shutting it down) are reserved for us.

The connection is not encrypted, which is why access is limited to your allowed IP addresses. Connect from servers in the same data centre or over a private network where possible.