MemoryStore quickstart
In about five minutes you will create a MemoryStore instance, save its password (shown exactly once), watch it become ready, check live stats, and run PING, SET, and GET against it.
Before you begin
-
You have a platform account and can sign in. If not, ask your administrator for an account or an invitation link — see Create an account.
-
You have installed the platformctl CLI and run
platformctl login. -
For the
curltabs, you need your project ID. It is a UUID — a 36-character random identifier like7f3c1e02-9b5d-4a11-8c6f-2d0e5a91b4cc. Copy it from the console URL at https://console.codyhill.dev (#/projects/<uuid>/...), or runplatformctl projects list.export MS="https://api.codyhill.dev" # MemoryStore is served on the shared public APIexport CAI_PROJECT="00000000-0000-0000-0000-000000000000" # your project UUIDexport CAI_TOKEN="<your session token or API key>"The
platformctltabs need none of this — the CLI defaults to the same address and resolves your project itself.
Step 1: Create an instance
You are creating a small instance to use as a cache. That is why the request overrides the default eviction policy with allkeys-lru, which throws out the least recently used keys when memory fills up. The default policy, noeviction, would make writes fail instead — a deliberate default, because this store backs agent sessions as often as it backs a cache, and an evicted session is a conversation that silently forgets its first turn.
- platformctl
- curl
- Console
Only the name is required; every other field has a server-side default.
platformctl memorystore create cache --maxmemory-policy allkeys-lru
You should see:
name: cache
state: unknown
host: <private-hostname>
port: 6379
username: default
credential secret: ms-cache-credential
password (shown once):
<24-random-bytes>
uri: redis://:<password>@<private-hostname>:6379
This is the only response that contains the password. Later reads return the name of the Secret holding it, never the value. The instance is still provisioning; poll until it reports ready before connecting.
curl -sX POST "$MS/v1/projects/$CAI_PROJECT/memorystores" \
-H "Authorization: Bearer $CAI_TOKEN" -H 'Content-Type: application/json' \
-d '{"name":"cache","size_class":"small","maxmemory_policy":"allkeys-lru"}'
You should see (HTTP 201):
{"memorystore":{"name":"cache","state":"unknown","ready":false,"message":"not reconciled yet","size_class":"small",...},
"credential":{"username":"default",
"password":"<24-random-bytes>",
"uri":"redis://:<password>@<private-hostname>:6379"},
"note":"This is the only response that contains the password. Later reads return the name of the Secret holding it, never the value. The instance is still provisioning; poll until it reports ready before connecting."}
Go to Data services → MemoryStore in your project and click Create instance. Set the eviction policy to allkeys-lru in the Create a MemoryStore instance dialog.
The password appears in a copy-once dialog, and the console offers to save it straight into your project's Secrets — which is the easiest way to not lose it.
The response reports state as unknown, not provisioning. That is deliberate: the instance was created a millisecond ago and nothing has looked at it yet, so the API reports the truth rather than guessing at progress. Read it again a moment later and you will see provisioning, then ready. The state words are always lowercase — unknown, provisioning, ready, degraded, deleting — so a comparison against "ready" means the same thing here as it does on every other resource.
Beside state sit two more fields you will see on everything the platform returns: ready, a plain boolean that answers "can I connect to this yet", and message, which says why not while the answer is no. state is the word to show a person; ready is the field to branch on in code.
This is the only time the API will ever show you the password. Every later read returns the name of the Secret that holds it, never the value itself. Save the credential somewhere safe before you move on. If you lose it, an admin can issue a new one with platformctl memorystore rotate-credential cache.
export MS_PASSWORD="<the password from the response>"
Step 2: Wait for it to be ready
- platformctl
- curl
- Console
platformctl memorystore get cache
You should see (usually within ~15 seconds):
NAME SIZE_CLASS STATE READY
cache small ready yes
curl -s "$MS/v1/projects/$CAI_PROJECT/memorystores/cache" \
-H "Authorization: Bearer $CAI_TOKEN" | jq '.state, .ready'
You should see:
"ready"
true
The instance list shows the state, and refreshes on its own while the instance is provisioning.
What failure looks like
Ask for stats before the instance is provisioned and you get a 409 with a plain-English explanation:
{"error":"this memorystore is not provisioned yet; wait until it reports ready, then read its stats","request_id":"..."}
Step 3: Check live stats
Once the instance reports ready, the platform reads live server statistics on your behalf. You do not need a connection of your own.
- platformctl
- curl
- Console
platformctl memorystore stats cache
You should see a key/value table including lines like:
used_memory_human 1.00M
maxmemory_policy allkeys-lru
connected_clients 1
db_keys 0
uptime_in_seconds 42
curl -s "$MS/v1/projects/$CAI_PROJECT/memorystores/cache/stats" \
-H "Authorization: Bearer $CAI_TOKEN"
The response inlines the statistics alongside the instance name: used_memory_bytes, used_memory_human, maxmemory_policy, used_memory_pct, connected_clients, keyspace_hits, keyspace_misses, hit_rate, evicted_keys, db_keys, uptime_in_seconds, and more.
Open the instance and read its stats panel. It refreshes on demand rather than graphing over time, for the reason below.
These values are read straight from the running instance at the moment you ask. They are a snapshot, not a history you can graph over time.
Step 4: Connect and run PING, SET, GET
The instance is private. It has no public address, so your laptop cannot reach it.
Port 6379 on the address below is firewalled. Only the platform's own components may reach it — your agents, functions, and services may not, and a plain redis:// connection from them times out with no explanation.
The supported route for your own code is the opt-in TLS endpoint, which you have to turn on when you create the instance. Connect from workloads covers who can reach what, and how to create an instance with that endpoint enabled.
The commands below are the ones to run once you have a route to the instance. Over the TLS endpoint they are the same commands with --tls and port 443.
You already have the exact hostname: it is the host part of the uri you saved in step 1.
export MS_HOST="<private-hostname>" # copy the host out of the 'uri' field
Then check that the instance answers:
redis-cli -h "$MS_HOST" -p 6379 -a "$MS_PASSWORD" PING
You should see:
PONG
Now a round trip:
redis-cli -h "$MS_HOST" -p 6379 -a "$MS_PASSWORD" SET greeting "hello"
redis-cli -h "$MS_HOST" -p 6379 -a "$MS_PASSWORD" GET greeting
You should see:
OK
hello
MemoryStore speaks the Redis wire protocol, so any Redis client library works unchanged — redis-cli above is just the quickest one to reach for.
Clean up
Deleting an instance destroys it and its data volume. This is not reversible, and it requires the project admin role.
- platformctl
- curl
- Console
platformctl memorystore delete cache
curl -sX DELETE "$MS/v1/projects/$CAI_PROJECT/memorystores/cache" \
-H "Authorization: Bearer $CAI_TOKEN"
You should see (HTTP 202):
{"name":"cache","resource_path":"projects/<short>/memorystores/cache","state":"deleting","ready":false,
"note":"The instance and its data volume are being reclaimed. This is not reversible."}
Open the instance and click Delete, then confirm.
The API answers 202 rather than 204 because the deletion is asynchronous: the platform still has to stop the instance and reclaim the volume, and reporting "done" would claim the storage is already gone.
Next steps
- Connect from workloads — the credential Secret, agents and functions, and the external TLS endpoint.
- Use with agents — where agent sessions live (spoiler: not in this instance).
- API reference — every field on create, including persistence and external exposure.