Muokkaa

Jaa


Azure Cache for Redis samples

You'll find a list of Azure Cache for Redis samples in this article. The samples cover scenarios such as:

  • Connecting to a cache
  • Reading and writing data to and from a cache
  • And using the ASP.NET Azure Cache for Redis providers.

Some samples are downloadable projects. Other samples provide step-by-step guidance that includes code snippets but don't link to a downloadable project.

Hello world samples

The samples in this section show the basics of connecting to an Azure Cache for Redis instance. The sample also shows reading and writing data to the cache using different languages and Redis clients.

The Hello world sample shows how to do various cache operations using the StackExchange.Redis .NET client.

This sample shows how to:

  • Use various connection options
  • Read and write objects to and from the cache using synchronous and asynchronous operations
  • Use Redis MGET/MSET commands to return values of specified keys
  • Perform Redis transactional operations
  • Work with Redis lists and sorted sets
  • Store .NET objects using JsonConvert serializers
  • Use Redis sets to implement tagging
  • Work with Redis Cluster

For more information, see the StackExchange.Redis documentation on GitHub. For more usage scenarios, see the StackExchange.Redis.Tests unit tests.

How to use Azure Cache for Redis with Python shows how to get started with Azure Cache for Redis using Python and the redis-py client.

Work with .NET objects in the cache shows you one way to serialize .NET objects to write them to and read them from an Azure Cache for Redis instance.

Use Azure Cache for Redis as a Scale out Backplane for ASP.NET SignalR

The Use Azure Cache for Redis as a Scale out Backplane for ASP.NET SignalR sample demonstrates how to use Azure Cache for Redis as a SignalR backplane. For more information about backplane, see SignalR Scaleout with Redis.

Azure Cache for Redis customer query sample

This sample compares performance between accessing data from a cache and accessing data from persistence storage. This sample has two projects.

ASP.NET Session State and Output Caching

The Use Azure Cache for Redis to store ASP.NET SessionState and OutputCache sample demonstrates:

  • How to use Azure Cache for Redis to store ASP.NET Session and Output Cache
  • Using the SessionState and OutputCache providers for Redis.

Manage Azure Cache for Redis with MAML

The Manage Azure Cache for Redis using Azure Management Libraries sample demonstrates how to use Azure Management Libraries to manage - (Create/ Update/ delete) your cache.

Custom monitoring sample

The Access Azure Cache for Redis Monitoring data sample demonstrates how to access monitoring data for your Azure Cache for Redis outside of the Azure portal.

An X-style clone written using PHP and Redis

The Retwis sample is the Redis Hello World. It's a minimal X-style social network clone written using Redis and PHP using the Predis client. The source code is designed to be simple and at the same time to show different Redis data structures.

Bandwidth monitor

The Bandwidth monitor sample allows you to monitor the bandwidth used on the client. To measure the bandwidth, run the sample on the cache client machine, make calls to the cache, and observe the bandwidth reported by the bandwidth monitor sample.