Caching Application Data Using Redis Cloud by Redis Labs

You can use Redis Labs Cloud to cache application data. Redis Cloud is a fully-managed service offering a variety of options for running Redis.

Pricing

Redis Labs offers a free tier that provides 30 MB of storage.

Setting up

To use Redis by Redis Labs:

  1. Sign up for a Redis Labs Cloud account.
  2. Create a Redis Database using Redis Cloud. Be sure to specify GCE/us-central1 as the Cloud for the lowest latency. Specify a strong password as your Redis instance will be publicly accessible.
  3. Note the Endpoint for the database.

Installing a Redis client library

The sample project uses the Nuget package Google.Cloud.Storage.V1.

Connecting to Redis by Redis Labs

Edit appsettings.json and add your Redis Endpoint:

{
  "RedisEndpoint": "your-redis-endpoint",
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}

Testing Redis locally

If you are testing your app locally, you can still connect to your the Redis Labs Redis database. However, you might want to run a local instance of Redis to avoid interacting with production data.

Follow the directions in the Redis documentation to install and run Redis locally. Note that it currently isn't possible to run Redis locally on Windows.

Send feedback about...

App Engine flexible environment for .NET docs