How Memorystore for Redis in your GCP VPC compares with Upstash Redis on pricing, networking from Cloud Run, limits and local development, and how to declare the cache in Go so it becomes Memorystore on deploy.

Memorystore for Redis and Upstash Redis both speak the Redis protocol, and they live in different places. Memorystore is a Redis instance on a private IP in your Google Cloud VPC, billed by provisioned GiB per hour. Upstash is serverless Redis on the public internet, billed per command or by a fixed plan.
On GCP the decision usually comes down to networking and the shape of the bill. A Cloud Run service needs VPC egress to reach Memorystore, and gets a predictable cost in return, while Upstash works from anywhere and charges for every command.
This guide compares the two and then shows a Go cache that Encore runs locally and provisions as Memorystore in your own project. Encore does not provision Upstash.
Memorystore prices come from the Memorystore for Redis pricing page for us-central1, and Upstash prices from its Redis pricing page, both checked on November 18, 2026. Standard M1 is $0.064 per GiB-hour, and the per-GiB rate falls in the larger capacity tiers.
Memorystore charges for provisioned capacity at any traffic level, so a 1 GiB Basic instance costs about $36 a month at zero traffic and the same at a few thousand commands per second. Upstash pay as you go is $0.20 per 100,000 commands, which puts 10 million commands a month at $20 and 100 million at $200. A cache that handles a busy API crosses Memorystore's flat cost quickly, and a cache for a side project or a staging environment rarely does.
Upstash fixed plans flatten the per-command cost, starting at $10 a month for 250 MB, and they cap the rate at 10,000 commands per second on the smaller tiers. Memorystore throughput follows the instance's network tier, at least 10 Gbps for M1 according to the pricing table.
Memorystore has no public endpoint, so a Cloud Run service reaches it through Direct VPC egress or a Serverless VPC Access connector, with the instance's authorized network set to the same VPC, and AUTH and in-transit encryption are options you turn on per instance. A developer laptop cannot reach it without a bastion or a tunnel, which is why local development usually runs a separate Redis.
Upstash works from Cloud Run without any VPC setup, which is the main reason it shows up in projects that have no VPC yet. The trade-off is that every session lookup or rate-limit counter goes to a provider outside your project over the internet, and the latency from Cloud Run depends on choosing an Upstash region close to the service.
Memorystore for Redis runs open source Redis with a fixed version per instance, and Google also offers Memorystore for Redis Cluster and Memorystore for Valkey for larger or sharded workloads, billed per node. Upstash supports most Redis commands, along with its REST client and features like global read regions, with limits on request size and command rate per plan that are worth checking for Lua scripts and large values.
Encore brings infrastructure from code: a cache cluster and its typed keyspaces are declarations in the Go service that uses them. encore run starts an in-memory Redis for local development, as the caching docs describe, and a deploy to GCP provisions Memorystore for Redis in your project, per the GCP infrastructure docs, with the service and the cache on the same private network. The same declaration becomes ElastiCache on AWS.

Run in your terminal to get started locally.
// rates/rates.go
package rates
import (
"context"
"errors"
"time"
"encore.dev/storage/cache"
)
var cluster = cache.NewCluster("rates", cache.ClusterConfig{
EvictionPolicy: cache.AllKeysLRU,
})
type Rate struct {
Pair string `json:"pair"`
Value float64 `json:"value"`
FetchedAt time.Time `json:"fetched_at"`
}
var rates = cache.NewStructKeyspace[string, Rate](cluster, cache.KeyspaceConfig{
KeyPattern: "rate/:key",
DefaultExpiry: cache.ExpireIn(5 * time.Minute),
})
type GetParams struct {
Pair string `query:"pair"`
}
//encore:api public method=GET path=/rates
func Get(ctx context.Context, p *GetParams) (*Rate, error) {
r, err := rates.Get(ctx, p.Pair)
if err == nil {
return &r, nil
}
if !errors.Is(err, cache.Miss) {
return nil, err
}
r = Rate{Pair: p.Pair, Value: fetchRate(p.Pair), FetchedAt: time.Now()}
if err := rates.Set(ctx, p.Pair, r); err != nil {
return nil, err
}
return &r, nil
}
// fetchRate stands in for the slow upstream call you are caching.
func fetchRate(pair string) float64 {
return 1.08
}
The keyspace type, key pattern and expiry live in the same file as the endpoint that reads them, so a cache entry cannot drift from the code that depends on it. A coding agent that adds caching to an endpoint writes the keyspace in that change and checks the hit and miss paths with encore run, without a Memorystore IP or an Upstash token in the code. Encore provisions an IAM role for the service, or a service account on GCP.
Best fit: Go or TypeScript backends on GCP that want the cache declared in application code, running locally, and provisioned as Memorystore on the same private network as the services.
Pick Upstash for low or bursty traffic, staging environments and edge or serverless clients that need Redis over HTTPS. Pick Memorystore for a backend on Cloud Run or GKE with steady traffic, where a fixed hourly cost and a private IP beat a per-command bill and an internet round trip. Pick Encore when you want that Memorystore instance declared next to the code that uses it, with a local Redis from encore run.
Use Memorystore when the backend runs on Cloud Run or GKE in the same project and you want Redis on a private IP with a fixed hourly bill. Use Upstash when traffic is low or spiky enough that per-command billing stays cheaper, or when the clients are edge or serverless functions that need Redis over HTTPS.
On Google's pricing page, a Basic M1 Memorystore instance in us-central1 is $0.049 per GiB-hour, about $36 a month for 1 GiB, and Standard M1 with a replica is $0.064 per GiB-hour. Upstash pay as you go is $0.20 per 100,000 commands with a 250 MB free plan, and fixed plans start at $10 a month. Both checked on November 18, 2026.
Memorystore has only a private IP in your VPC, so a Cloud Run service needs Direct VPC egress or a Serverless VPC Access connector to reach it. Upstash is reachable over the public internet with TLS or its REST API, so Cloud Run can call it without VPC configuration.
Declare a cache cluster and a keyspace with encore.dev/storage/cache in Go. encore run starts an in-memory Redis locally, and a deploy to GCP provisions Memorystore for Redis in your project, or ElastiCache on AWS from the same code.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.