Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 65dc014

Browse files
committedNov 4, 2019
redis-cache
1 parent f90c6d5 commit 65dc014

13 files changed

+56
-71
lines changed
 
Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'Quickstart: Create a Python app that uses Azure Cache for Redis'
3-
description: In this quickstart, you learn how to create an Python App that uses Azure Cache for Redis
3+
description: In this quickstart, you learn how to create an Python App that uses Azure Cache for Redis.
44
services: cache
55
documentationcenter: ''
66
author: yegu-ms
@@ -14,10 +14,10 @@ ms.topic: conceptual
1414
ms.tgt_pltfrm: cache
1515
ms.workload: tbd
1616
ms.topic: quickstart
17-
ms.date: 05/11/2018
17+
ms.date: 11/01/2019
1818
ms.author: yegu
1919
ms.custom: [mvc, seo-python-october2019]
20-
#Customer intent: As a Python developer, new to Azure Cache for Redis, I want to create a new Python app that uses Azure Cache for Redis.
20+
#Customer intent: As a Python developer new to Azure Cache for Redis, I want to create a new Python app that uses Azure Cache for Redis.
2121
---
2222
# Quickstart: Create a Python app that uses Azure Cache for Redis
2323

@@ -28,31 +28,26 @@ In this article, you incorporate Azure Cache for Redis into a Python app to have
2828
- Azure subscription - [create one for free](https://azure.microsoft.com/free/)
2929
- [Python 2 or 3](https://www.python.org/downloads/)
3030

31-
## Create an Azure Cache for Redis on Azure
31+
## Create an Azure Cache for Redis
3232
[!INCLUDE [redis-cache-create](../../includes/redis-cache-create.md)]
3333

3434
[!INCLUDE [redis-cache-create](../../includes/redis-cache-access-keys.md)]
3535

3636
## Install redis-py
3737

38-
[Redis-py](https://github.com/andymccurdy/redis-py) is a Python interface to Azure Cache for Redis. Use the Python packages tool, *pip*, to install the redis-py package.
38+
[Redis-py](https://github.com/andymccurdy/redis-py) is a Python interface to Azure Cache for Redis. Use the Python packages tool, *pip*, to install the *redis-py* package from a command prompt.
3939

40-
The following example uses *pip3* for Python3 to install the redis-py package on Windows 10 using a Visual Studio 2019 Developer Command prompt running with elevated Administrator privileges.
41-
42-
```python
43-
pip3 install redis
44-
```
40+
The following example used *pip3* for Python 3 to install *redis-py* on Windows 10 from an Administrator command prompt.
4541

4642
![Install the redis-py Python interface to Azure Cache for Redis](./media/cache-python-get-started/cache-python-install-redis-py.png)
4743

48-
4944
## Read and write to the cache
5045

51-
Run Python and test using the cache from the command line. Replace `<Your Host Name>` and `<Your Access Key>` with the values for your Azure Cache for Redis.
46+
Run Python from the command line and test your cache by using the following code. Replace `<Your Host Name>` and `<Your Access Key>` with the values from your Azure Cache for Redis instance.
5247

5348
```python
5449
>>> import redis
55-
>>> r = redis.StrictRedis(host='<Your Host Name>.redis.cache.windows.net',
50+
>>> r = redis.StrictRedis(host='<Your Host Name>',
5651
port=6380, db=0, password='<Your Access Key>', ssl=True)
5752
>>> r.set('foo', 'bar')
5853
True
@@ -61,18 +56,16 @@ b'bar'
6156
```
6257

6358
> [!IMPORTANT]
64-
> For Redis version is 3.0 or higher, SSL certificate check is enforced. ssl_ca_certs must be explicitly set when connecting to Redis. In case of RH Linux, ssl_ca_certs can be found in the "/etc/pki/tls/certs/ca-bundle.crt" certificate module.
65-
66-
## Create a Python script
59+
> For Azure Cache for Redis version 3.0 or higher, SSL certificate check is enforced. ssl_ca_certs must be explicitly set when connecting to Azure Cache for Redis. For RedHat Linux, ssl_ca_certs are in the */etc/pki/tls/certs/ca-bundle.crt* certificate module.
6760
68-
Create a new script text file named *PythonApplication1.py*.
61+
## Create a Python sample app
6962

70-
Add the following script to *PythonApplication1.py* and save the file. This script will test the cache access. Replace `<Your Host Name>` and `<Your Access Key>` with the values for your Azure Cache for Redis.
63+
Create a new text file, add the following script, and save the file as *PythonApplication1.py*. Replace `<Your Host Name>` and `<Your Access Key>` with the values from your Azure Cache for Redis instance.
7164

7265
```python
7366
import redis
7467

75-
myHostname = "<Your Host Name>.redis.cache.windows.net"
68+
myHostname = "<Your Host Name>"
7669
myPassword = "<Your Access Key>"
7770

7871
r = redis.StrictRedis(host=myHostname, port=6380,
@@ -93,36 +86,27 @@ for c in result:
9386
print("id : " + c['id'] + ", addr : " + c['addr'])
9487
```
9588

96-
Run the script with Python.
97-
98-
![Run Python script to test cache access in Azure Cache for Redis](./media/cache-python-get-started/cache-python-completed.png)
89+
Run the sample app with Python to see results like the following example:
9990

91+
![Run Python script to test cache access](./media/cache-python-get-started/cache-python-completed.png)
10092

10193
## Clean up resources
10294

103-
If you will be continuing with another tutorial, you can keep the resources created in this quickstart and reuse them.
104-
105-
Otherwise, if you are finished with the quickstart sample application, you can delete the Azure resources created in this quickstart to avoid charges.
95+
If you're finished with the Azure resource group and resources you created in this quickstart, you can delete them to avoid charges.
10696

10797
> [!IMPORTANT]
108-
> Deleting a resource group is irreversible and that the resource group and all the resources in it are permanently deleted. Make sure that you do not accidentally delete the wrong resource group or resources. If you created the resources for hosting this sample inside an existing resource group that contains resources you want to keep, you can delete each resource individually from their respective blades instead of deleting the resource group.
109-
>
110-
111-
Sign in to the [Azure portal](https://portal.azure.com) and select **Resource groups**.
112-
113-
In the **Filter by name...** text box, enter the name of your resource group. The instructions for this article used a resource group named *TestResources*. On your resource group in the result list, select **...** then **Delete resource group**.
114-
115-
![Delete your quickstart resource group for Azure Cache for Redis](./media/cache-web-app-howto/delete-your-resource-group-for-azure-cache-for-redis.png)
98+
> Deleting a resource group is irreversible, and the resource group and all the resources in it are permanently deleted. If you created your Azure Cache for Redis instance in an existing resource group that you want to keep, you can delete just the cache by selecting **Delete** from the cache **Overview** page.
11699
117-
You will be asked to confirm the deletion of the resource group. Enter the name of your resource group to confirm, and select **Delete**.
100+
To delete the resource group and all its resources:
118101

119-
After a few moments, the resource group and all of its contained resources are deleted.
102+
1. From the [Azure portal](https://portal.azure.com), search for and select **Resource groups**.
103+
1. In the **Filter by name** text box, enter the name of your resource group, and then select it from the search results.
104+
1. On your resource group page, select **Delete resource group**.
105+
1. Type the resource group name, and then select **Delete**. The resource group and all of its resources are deleted.
106+
![Delete your resource group for Azure Cache for Redis](./media/cache-python-get-started/delete-your-resource-group-for-azure-cache-for-redis.png)
120107

121108
## Next steps
122109

123110
> [!div class="nextstepaction"]
124111
> [Create a simple ASP.NET web app that uses an Azure Cache for Redis.](./cache-web-app-howto.md)
125112
126-
<!--Image references-->
127-
[1]: ./media/cache-python-get-started/redis-cache-new-cache-menu.png
128-
[2]: ./media/cache-python-get-started/redis-cache-cache-create.png
Loading
Loading
Loading
Loading
Loading
Loading
Loading

‎includes/redis-cache-access-keys.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@ services: redis-cache
55
author: wesmc7777
66
ms.service: cache
77
ms.topic: "include"
8-
ms.date: 03/28/2018
8+
ms.date: 11/01/2019
99
ms.author: wesmc
1010
ms.custom: "include file"
1111
---
1212

13-
### Retrieve host name, ports, and access keys by using the Azure portal
13+
### Retrieve host name, ports, and access keys from the Azure portal
1414

15-
When connecting to an Azure Cache for Redis instance, cache clients need the host name, ports, and a key for the cache. Some clients might refer to these items by slightly different names. You can retrieve this information in the Azure portal.
15+
To connect to an Azure Cache for Redis instance, cache clients need the host name, ports, and a key for the cache. Some clients might refer to these items by slightly different names. You can get the host name, ports, and keys from the [Azure portal](https://portal.azure.com).
1616

17-
#### To retrieve the access keys and host name
17+
- To get the access keys, from your cache left navigation, select **Access keys** .
18+
19+
![Azure Cache for Redis keys](media/redis-cache-access-keys/redis-cache-keys.png)
1820

19-
1. To retrieve the access keys by using the [Azure portal](https://portal.azure.com), go to your cache and select **Access keys**.
21+
- To get the host name and ports, from your cache left navigation, select **Properties**.
2022

21-
![Azure Cache for Redis keys](media/redis-cache-access-keys/redis-cache-keys.png)
22-
23-
2. To retrieve the host name and ports, select **Properties**.
24-
25-
![Azure Cache for Redis properties](media/redis-cache-access-keys/redis-cache-hostname-ports.png)
23+
![Azure Cache for Redis properties](media/redis-cache-access-keys/redis-cache-hostname-ports.png)
2624

‎includes/redis-cache-create.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@ services: redis-cache
55
author: wesmc7777
66
ms.service: cache
77
ms.topic: "include"
8-
ms.date: 03/28/2018
8+
ms.date: 11/01/2019
99
ms.author: wesmc
1010
ms.custom: "include file"
1111
---
1212

1313

14-
1. To create a cache, first sign in to the [Azure portal](https://portal.azure.com). Then select **Create a resource** > **Databases** > **Azure Cache for Redis**.
15-
16-
![New Azure Cache for Redis menu](media/redis-cache-create/redis-cache-new-cache-menu.png)
17-
18-
2. In **New Azure Cache for Redis**, configure the settings for your new cache.
19-
20-
| Setting | Suggested value | Description |
21-
| ------------ | ------- | -------------------------------------------------- |
22-
| **DNS name** | Globally unique name | The cache name. It must be a string between 1 and 63 characters and contain only numbers, letters, and the `-` character. The cache name cannot start or end with the `-` character, and consecutive `-` characters are not valid. |
23-
| **Subscription** | Your subscription | The subscription under which this new Azure Cache for Redis instance is created. |
24-
| **Resource group** | *TestResources* | Name for the new resource group in which to create your cache. By putting all the resources for an app in a group, you can manage them together. For example, deleting the resource group deletes all resources that are associated with the app. |
25-
| **Location** | East US | Choose a [region](https://azure.microsoft.com/regions/) near to other services that will use your cache. |
26-
| **[Pricing tier](https://azure.microsoft.com/pricing/details/cache/)** | Basic C0 (250 MB Cache) | The pricing tier determines the size, performance, and features that are available for the cache. For more information, see [Azure Cache for Redis Overview](../articles/azure-cache-for-redis/cache-overview.md). |
27-
| **Pin to dashboard** | Selected | Pin the new cache to your dashboard to make it easy to find. |
28-
29-
![Create Azure Cache for Redis](media/redis-cache-create/redis-cache-cache-create.png)
30-
31-
3. After the new cache settings are configured, select **Create**.
32-
33-
It can take a few minutes for the cache to be created. To check the status, you can monitor the progress on the dashboard. After the cache has been created, it shows the status **Running**, and is ready for use.
34-
35-
![Azure Cache for Redis created](media/redis-cache-create/redis-cache-cache-created.png)
14+
1. To create a cache, sign in to the [Azure portal](https://portal.azure.com) and select **Create a resource**.
15+
16+
![Select Create a resource](media/redis-cache-create/create-a-resource.png)
17+
18+
1. On the **New** page, select **Databases** and then select **Azure Cache for Redis**.
19+
20+
![Select Azure Cache for Redis](media/redis-cache-create/redis-cache-new-cache-menu.png)
21+
22+
1. On the **New Redis Cache** page, configure the settings for your new cache.
23+
24+
| Setting | Suggested value | Description |
25+
| ------------ | ------- | -------------------------------------------------- |
26+
| **DNS name** | Enter a globally unique name. | The cache name must be a string between 1 and 63 characters and contain only numbers, letters, or hyphens. The name must start and end with a number or letter, and not contain consecutive hyphens. |
27+
| **Subscription** | Drop down and select your subscription. | The subscription under which to create this new Azure Cache for Redis instance. |
28+
| **Resource group** | Drop down and select a resource group, or select **Create new** and enter a new resource group name. | Name for the resource group in which to create your cache and other resources. By putting all your app resources in one resource group, you can easily manage or delete them together. |
29+
| **Location** | Drop down and select a location. | Select a [region](https://azure.microsoft.com/regions/) near other services that will use your cache. |
30+
| **Pricing tier** | Drop down and select a [Pricing tier](https://azure.microsoft.com/pricing/details/cache/). | The pricing tier determines the size, performance, and features that are available for the cache. For more information, see [Azure Cache for Redis Overview](../articles/azure-cache-for-redis/cache-overview.md). |
31+
32+
1. Select **Create**.
33+
34+
![Create Azure Cache for Redis](media/redis-cache-create/redis-cache-cache-create.png)
35+
36+
It takes awhile for the cache to create. You can monitor progress on the Azure Cache for Redis **Overview** page. When **Status** shows as **Running**, the cache is ready to use.
37+
38+
![Azure Cache for Redis created](media/redis-cache-create/redis-cache-cache-created.png)
3639

0 commit comments

Comments
 (0)
Please sign in to comment.