Memcached
A fast, ephemeral in-memory cache for keys you can regenerate from your source of truth.
Creating a Memcached instance
From the phase canvas, click + Service → Add-ons → Memcached, then Commit. StackBlaze provisions the instance and gives it a stable internal hostname.
Attach Memcached from the add-on Connections list or the app Add-ons tab. StackBlaze injects MEMCACHED_HOST, MEMCACHED_PORT, and MEMCACHED_LOCATION (host:11211).
Memcached is a simple, very fast in-memory key-value cache for ephemeral data. It has no persistence: keys live only in memory and are meant to be regenerated on demand. Use it to take load off a slower backing store (a database or an external API) by caching the results of expensive lookups.
Connecting
Memcached speaks its own lightweight text and binary protocol on port 11211. Use MEMCACHED_LOCATION (host:port) or MEMCACHED_HOST + MEMCACHED_PORT.
[service-name]:11211Connect from within the cluster using this address. There is no connection URL scheme and, by design, no query language: you set, get, and delete keys.
Browse and query with CloudBeaver
Every database add-on ships with CloudBeaver. Open with DB Beaver on the add-on's Overview starts a scoped session where you can browse tables, run SQL, and edit data in the browser.
Deployment model
Memcached runs as a Standard single instance. It is an ephemeral cache that holds no durable data and does not replicate, so there is no high-availability mode. If the node is lost, the keys it held are simply re-fetched from your source of truth (your database) on the next request and written back into the cache.
For more cache capacity, you can add nodes and shard keys across them client-side. Most Memcached clients support a server list and hash each key to a server, so adding a node spreads keys without any coordination between the nodes themselves.
| Property | Memcached |
|---|---|
| Topology | Standard, single instance |
| Persistence | None (in-memory only) |
| Replication | None |
| Scaling out | Add nodes and shard keys client-side |
Cache only
Connecting from Python
The pymemcache client can take MEMCACHED_LOCATION (host:port).
import os
from pymemcache.client.base import Client
# e.g. "[instance]:11211"
host, port = os.environ["MEMCACHED_LOCATION"].split(":")
client = Client((host, int(port)))
client.set("user:42", "Ada Lovelace", expire=3600) # TTL: 1 hour
value = client.get("user:42")
print(value) # b"Ada Lovelace" (or None if the key was evicted)When to use Memcached vs Redis
Use Memcached when you want the simplest possible pure in-memory cache: keys, values, and TTLs, nothing more. Reach for Redis (Valkey) when you need persistence, richer data structures (lists, sets, sorted sets, hashes), pub/sub messaging, or replication. See /docs/databases/redis for the Redis offering.
Under the hood