forked from Azure-Samples/azure-cache-redis-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update repo docs and add the quickstarts
- Update the repo docs to align with other similar Azure service sample repos. - Add the code from the docs.microsoft.com Azure Cache for Redis quickstart articles.
- Loading branch information
1 parent
110ba5a
commit fc04126
Showing
47 changed files
with
1,844 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Microsoft Open Source Code of Conduct | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
|
||
Resources: | ||
|
||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) | ||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) | ||
- Contact [[email protected]](mailto:[email protected]) with questions or concerns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!-- | ||
IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE MIGHT BE CLOSED WITHOUT FURTHER CONSIDERATION OR INVESTIGATION | ||
--> | ||
> Please provide us with the following information: | ||
> --------------------------------------------------------------- | ||
### This issue is for a: (mark with an `x`) | ||
``` | ||
- [ ] bug report -> please search issues before submitting | ||
- [ ] feature request | ||
- [ ] documentation issue or request | ||
- [ ] regression (a behavior that used to work and stopped in a new release) | ||
``` | ||
|
||
### Minimal steps to reproduce | ||
> | ||
### Any log messages given by the failure | ||
> | ||
### Expected/desired behavior | ||
> | ||
### OS and Version? | ||
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) | ||
### Versions | ||
> | ||
### Mention any other details that might be useful | ||
|
||
> --------------------------------------------------------------- | ||
> Thanks! We'll be in touch soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Purpose | ||
<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? --> | ||
* ... | ||
|
||
## Pull Request Type | ||
What kind of change does this Pull Request introduce? | ||
|
||
<!-- Please check the one that applies to this PR using "x". --> | ||
``` | ||
[ ] Bugfix | ||
[ ] Feature | ||
[ ] Code style update (formatting, local variables) | ||
[ ] Refactoring (no functional changes, no api changes) | ||
[ ] Documentation content changes | ||
[ ] Other... Please describe: | ||
``` | ||
|
||
## Other Information | ||
<!-- Add any other helpful information that may be needed here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Contributing to the samples repository for Azure Cache for Redis | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. | ||
|
||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
- [Code of conduct](#code-of-conduct) | ||
- [Issues and bugs](#found-an-issue) | ||
- [Feature requests](#want-a-feature) | ||
- [Submission guidelines](#submission-guidelines) | ||
|
||
## Code of conduct | ||
|
||
Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
|
||
## Found an issue? | ||
|
||
If you find a bug in the source code or a mistake in the documentation, you can help us by | ||
[submitting an issue](#submitting-an-issue) to the GitHub Repository. Even better, you can | ||
[submit a Pull Request](#submitting-a-pull-request-pr) with a fix. | ||
|
||
## Want a feature? | ||
|
||
You can _request_ a new feature by [submitting an issue](#submitting-an-issue) to the GitHub | ||
Repository. If you would like to _implement_ a new feature, please submit an issue with | ||
a proposal for your work first, to be sure that we can use it. | ||
|
||
- **Small Features** can be crafted and directly [submitted as a Pull Request](#submitting-a-pull-request-pr). | ||
|
||
## Submission guidelines | ||
|
||
### Submitting an issue | ||
|
||
Before you submit an issue, search the archive, maybe your question was already answered. | ||
|
||
If your issue appears to be a bug, and hasn't been reported, open a new issue. | ||
Help us to maximize the effort we can spend fixing issues and adding new | ||
features, by not reporting duplicate issues. Providing the following information will increase the | ||
chances of your issue being dealt with quickly: | ||
|
||
- **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps | ||
- **Version** - what version is affected (e.g. 0.1.2) | ||
- **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you | ||
- **Browsers and Operating System** - is this a problem with all browsers? | ||
- **Reproduce the Error** - provide a live example or a unambiguous set of steps | ||
- **Related Issues** - has a similar issue been reported before? | ||
- **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be | ||
causing the problem (line of code or commit) | ||
|
||
You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/Azure-Samples/azure-cache-redis/issues/new. | ||
|
||
### Submitting a pull request (PR) | ||
|
||
Before you submit your Pull Request (PR) consider the following guidelines: | ||
|
||
- Search the repository (https://github.com/Azure-Samples/azure-cache-redis/pulls) for an open or closed PR | ||
that relates to your submission. You don't want to duplicate effort. | ||
|
||
- Make your changes in a new git fork: | ||
|
||
- Commit your changes using a descriptive commit message | ||
- Push your fork to GitHub: | ||
- In GitHub, create a pull request | ||
- If we suggest changes then: | ||
- Make the required updates. | ||
- Rebase your fork and force push to your GitHub repository (this will update your Pull Request): | ||
|
||
```shell | ||
git rebase master -i | ||
git push --force-with-lease | ||
``` | ||
|
||
That's it! Thank you for your contribution! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,64 @@ | ||
--- | ||
page_type: sample | ||
languages: | ||
- aspx-csharp | ||
- csharp | ||
- go | ||
- java | ||
- javascript | ||
- nodejs | ||
- python | ||
- rust | ||
name: Azure Cache for Redis samples | ||
description: Learn how to use Azure Cache for Redis to have access to a secure, dedicated cache that is accessible from any application within Azure. | ||
products: | ||
- azure | ||
- aspnet | ||
- dotnet | ||
- dotnet-core | ||
- azure-cache-redis | ||
--- | ||
|
||
# Contributing | ||
# Samples repository for Azure Cache for Redis | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
This repository contains samples that demonstrate best practices and general recommendations to communicate with Azure Redis Cache Service caches from various Redis client frameworks. To find out more about the Azure Cache for Redis service, please visit the [documentation site](https://docs.microsoft.com/azure/azure-cache-for-redis). | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
## Get the samples | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
- The easiest way to use these samples without using Git is to download the current version as a [ZIP file](https://github.com/Azure-Samples/azure-cache-redis/archive/main.zip). | ||
|
||
- On Windows, before you unzip the archive, right-click it, select **Properties**, and then select **Unblock**. | ||
- Be sure to unzip the entire archive and not just individual samples. | ||
|
||
- Alternatively, clone this sample repository using a Git client. | ||
|
||
## Build and run the samples | ||
|
||
Please see the description of each individual sample for instructions on how to build and run it. | ||
|
||
### Azure Cache for Redis quickstarts | ||
|
||
The following quickstarts demonstrate how to incorporate Azure Cache for Redis into an app. | ||
If you want to create one of the quickstart apps from scratch, please follow the corresponding article on the [documentation site](https://docs.microsoft.com/azure/azure-cache-for-redis). | ||
|
||
| Quickstart | Platform | Description | | ||
| ---------- | -------- | ----------- | | ||
| [Quickstart ASP.NET for Windows](/quickstart/aspnet) | Windows | Learn how to use an ASP.NET web application to connect to Azure Cache for Redis to store and retrieve data from the cache. | | ||
| [Quickstart C# .NET for Windows](/quickstart/dotnet) | Windows | Learn how to incorporate Azure Cache for Redis into a C# .NET Framework console app using the StackExchange.Redis Redis client. | | ||
| [Quickstart C# .NET Core](/quickstart/dotnet-core) | Windows, Linux, macOS | Learn how to incorporate Azure Cache for Redis into a C# .NET Core console app using the StackExchange.Redis Redis client. | | ||
| [Quickstart Java](/quickstart/java) | Windows, Linux, macOS | Learn how to incorporate Azure Cache for Redis into a Java app using the Jedis Redis client. | | ||
| [Quickstart Node.js](/quickstart/nodejs) | Node.js | Learn how to incorporate Azure Cache for Redis into a Node.js app. | | ||
| [Quickstart Python](/quickstart/python) | Windows, Linux, macOS | Learn how to incorporate Azure Cache for Redis into a Python app. | | ||
| [Quickstart Rust](https://github.com/Azure-Samples/azure-redis-cache-rust-quickstart) | Windows, Linux, macOS | Learn how to incorporate Azure Cache for Redis into a Rust app. | | ||
| [Quickstart Go](https://github.com/Azure-Samples/azure-redis-cache-go-quickstart) | Windows, Linux, macOS | Learn how to incorporate Azure Cache for Redis into a Go app. | | ||
|
||
### Samples | ||
|
||
| Sample | Platform | Description | | ||
| ------ | -------- | ----------- | | ||
| [Reconnection in C# .NET console app with StackExchange.Redis](/dotNet/ClientSamples/StackExchange.Redis) | Windows | Learn a technique of forcing client reconnections to resolve certain exceptions automatically. | | ||
| [Basic, cluster, and pool connections in Java console app with Jedis and Lettuce](/Java/ClientSamples/) | Windows, Linux, macOS | Learn the general approaches for using Jedis's `JedisCluster` and `JedisPool` and Lettuce's `RedisClient` and `ConnectionPoolSupport`. | | ||
|
||
## Resources | ||
|
||
- [Azure Cache for Redis documentation](https://docs.microsoft.com/azure/azure-cache-for-redis) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
page_type: sample | ||
languages: | ||
- aspx-csharp | ||
- csharp | ||
name: 'Quickstart: Use Azure Cache for Redis with an ASP.NET web app' | ||
description: Learn how to use an ASP.NET web application to connect to Azure Cache for Redis to store and retrieve data from the cache. | ||
products: | ||
- azure | ||
- aspnet | ||
- azure-cache-redis | ||
--- | ||
# Quickstart: Use Azure Cache for Redis with an ASP.NET web app | ||
|
||
This sample shows you how to use an ASP.NET web application to connect to Azure Cache for Redis to store and retrieve data from the cache. See the [accompanying article](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-web-app-howto) on the documentation site for details, including best practices and how to create the sample code from scratch. | ||
|
||
## Prerequisites | ||
|
||
- Azure subscription - [create one for free](https://azure.microsoft.com/free/dotnet) | ||
- Azure Cache for Redis cache - [create one](https://docs.microsoft.com/azure/azure-cache-for-redis/quickstart-create-redis) | ||
- [Visual Studio 2019](https://www.visualstudio.com/downloads/) with the **ASP.NET and web development** and **Azure development** workloads. | ||
|
||
## Set up the working environment | ||
|
||
Create a file on your computer named *CacheSecrets.config* and place it in a location where it won't be checked in with the source code of your sample application. For this quickstart, the *CacheSecrets.config* file is located here, *C:\AppSecrets\CacheSecrets.config*. | ||
|
||
Edit the *CacheSecrets.config* file and add the following contents: | ||
|
||
```xml | ||
<appSettings> | ||
<add key="CacheConnection" value="<cache-name>.redis.cache.windows.net,abortConnect=false,ssl=true,allowAdmin=true,password=<access-key>"/> | ||
</appSettings> | ||
``` | ||
|
||
Replace `<cache-name>` with your cache host name. | ||
|
||
Replace `<access-key>` with the primary key for your cache. | ||
|
||
## Run the sample locally | ||
|
||
[Download the sample code to your development PC.](/README.md#get-the-samples) | ||
|
||
In Visual Studio, click **File** > **Open** > **Project/Solution**. | ||
|
||
Navigate to the folder containing this sample, and select the solution file contained within it. | ||
|
||
Open **Tools** > **NuGet Package Manager** > **Package Manager Console** and install the bootstrap NuGet package: | ||
|
||
```pwsh | ||
Install-Package bootstrap -Version 3.4.1 | ||
``` | ||
|
||
If the *CacheSecrets.config* file is not located at *C:\AppSecrets\CacheSecrets.config*, open your *web.config* file and update the `appSettings` `file` attribute to the correct path. | ||
|
||
In Visual Studio, select **Debug** > **Start Debugging** to build and start the app locally for testing and debugging. | ||
|
||
In the browser, select **Azure Cache for Redis Test** on the navigation bar. | ||
|
||
## Publish and run in Azure | ||
|
||
See the [accompanying article](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-web-app-howto) on the documentation site for details about how to publish and run the app in Azure. | ||
|
||
## References | ||
|
||
* [Quickstart article on the documentation site](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-web-app-howto) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30907.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redistest", "Redistest\Redistest.csproj", "{72342AE2-2A5C-44B6-8E4A-C65A78956F8F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{72342AE2-2A5C-44B6-8E4A-C65A78956F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{72342AE2-2A5C-44B6-8E4A-C65A78956F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{72342AE2-2A5C-44B6-8E4A-C65A78956F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{72342AE2-2A5C-44B6-8E4A-C65A78956F8F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0B1D3036-1947-4090-81FC-E8FD81C19AA5} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Web; | ||
using System.Web.Optimization; | ||
|
||
namespace Redistest | ||
{ | ||
public class BundleConfig | ||
{ | ||
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862 | ||
public static void RegisterBundles(BundleCollection bundles) | ||
{ | ||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include( | ||
"~/Scripts/jquery-{version}.js")); | ||
|
||
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( | ||
"~/Scripts/bootstrap.js")); | ||
|
||
bundles.Add(new StyleBundle("~/Content/css").Include( | ||
"~/Content/bootstrap.css", | ||
"~/Content/site.css")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Web; | ||
using System.Web.Mvc; | ||
|
||
namespace Redistest | ||
{ | ||
public class FilterConfig | ||
{ | ||
public static void RegisterGlobalFilters(GlobalFilterCollection filters) | ||
{ | ||
filters.Add(new HandleErrorAttribute()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.Mvc; | ||
using System.Web.Routing; | ||
|
||
namespace Redistest | ||
{ | ||
public class RouteConfig | ||
{ | ||
public static void RegisterRoutes(RouteCollection routes) | ||
{ | ||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | ||
|
||
routes.MapRoute( | ||
name: "Default", | ||
url: "{controller}/{action}/{id}", | ||
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.