Memorystore
TCP · port 6379 · orchestrated
Orchestrated service. Memorystore runs as a Redis 7 container managed by localgcp. Requires Docker. Container starts lazily on first connection.
Quick start
$ localgcp up --services=memorystore
Connecting
Use a standard Redis connection. Any Redis client works:
$ redis-cli -h localhost -p 6379
Go example
Connect with github.com/redis/go-redis/v9:
package main import ( "context" "fmt" "log" "github.com/redis/go-redis/v9" ) func main() { ctx := context.Background() rdb := redis.NewClient(&redis.Options{ Addr: "localhost:6379", }) defer rdb.Close() // SET a key err := rdb.Set(ctx, "greeting", "hello from localgcp", 0).Err() if err != nil { log.Fatal(err) } // GET the key val, err := rdb.Get(ctx, "greeting").Result() if err != nil { log.Fatal(err) } fmt.Println(val) // "hello from localgcp" }
Python example
Connect with the redis package:
import redis r = redis.Redis(host="localhost", port=6379) r.set("greeting", "hello from localgcp") print(r.get("greeting")) # b"hello from localgcp"
How it works
- Lazy TCP proxy -- localgcp listens on port 6379 and starts the Redis container on the first incoming connection
- redis:7-alpine image -- lightweight Redis 7 image pulled automatically by Docker
- No auth -- the container runs without a password, matching the zero-config local development experience
Not yet supported
- Data persistence across restarts
- AUTH / password authentication
- Redis Cluster mode