Skip to content

Commit fff546a

Browse files
Merge pull request #221200 from mksuni/redismysql-tutorial
Update tutorial-add-redis-to-mysql.md
2 parents 7960ad0 + 89c8445 commit fff546a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

articles/mysql/flexible-server/tutorial-add-redis-to-mysql.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: 'Quickstart: Boost performance for Azure Database for MySQL Flexible Server with Redis'
3-
description: "This tutorial shows how to add Redis cache to boost performance for your Azure Database for MySQL Flexible Server."
2+
title: 'Quickstart: Boost performance for Azure Database for MySQL Flexible Server with Azure Cache for Redis'
3+
description: "This tutorial shows how to add Azure Cache for Redis to boost performance for your Azure Database for MySQL Flexible Server."
44
ms.service: mysql
55
ms.subservice: flexible-server
66
ms.topic: quickstart
@@ -9,7 +9,7 @@ ms.author: sumuth
99
ms.date: 12/07/2022
1010
---
1111

12-
# Tutorial: Boost performance of Azure Database for MySQL flexible Server with Azure cache for Redis
12+
# Tutorial: Boost performance of Azure Database for MySQL flexible Server with Azure Cache for Redis
1313

1414
[!INCLUDE[applies-to-mysql-flexible-server](../includes/applies-to-mysql-flexible-server.md)]
1515

@@ -54,22 +54,22 @@ INSERT INTO tasks (id,title, completed) VALUES
5454

5555
[!INCLUDE [redis-cache-create](../../azure-cache-for-redis/includes/redis-cache-create.md)]
5656

57-
## Caching result of query using Python
57+
## Use Redis with Python
5858

5959
Install the latest version of [Python](https://www.python.org/) on your local environment or on an Azure virtual machine or Azure App Service. Use pip to install redis-py.
6060

6161
```python
6262
pip install redis
6363
```
6464

65-
The following code creates a connection to Redis using redis-py, stores the query result into the redis cache and fetch the value from the cache.
65+
The following code creates a connection to Azure Cache for Redis instance using redis-py, stores the query result into the Azure Cache for Redis and fetch the value from the cache.
6666

6767
```python
6868
import redis
6969
import mysql.connector
7070

7171
r = redis.Redis(
72-
host='your-azure-redis-server-name.redis.cache.windows.net',
72+
host='your-azure-redis-instance-name.redis.cache.windows.net',
7373
port=6379,
7474
password='azure-redis-primary-access-key')
7575

@@ -98,14 +98,14 @@ mysqlcnx.close()
9898

9999
Install [PHP](https://www.php.net/manual/en/install.php) on your local environment. Follow the steps below to write a PHP script that caches a SQL query from MySQL database. Here are a few pre-requisites before running the script:
100100

101-
1. Install and enable [Redis PECL extension](https://pecl.php.net/package/redis) to use Redis with your PHP script. See [how to install the extension locally](https://github.com/phpredis/phpredis/blob/develop/INSTALL.md)
101+
1. Install and enable [Redis PECL extension](https://pecl.php.net/package/redis) to use Azure Cache for Redis with your PHP script. See [how to install the extension locally](https://github.com/phpredis/phpredis/blob/develop/INSTALL.md)
102102
2. Install and enable [MySQL PDO extension](https://www.php.net/manual/en/ref.pdo-mysql.php)
103103

104104
```php
105105
<?php
106106

107107
$redis = new Redis();
108-
$redis->connect('azure-redis-servername.redis.cache.windows.net', 6379);
108+
$redis->connect('azure-redis-instance-ame.redis.cache.windows.net', 6379);
109109
$redis->auth('azure-redis-primary-access-key');
110110

111111
$key = 'tasks';
@@ -132,7 +132,7 @@ if (!$redis->get($key)) {
132132
$redis->expire($key, 10);
133133

134134
} else {
135-
/*Pulling data from Redis*/
135+
/*Pulling data from Azure Cache for Redis*/
136136
$tasks = unserialize($redis->get($key));
137137

138138
}
@@ -143,9 +143,9 @@ print_r($tasks);
143143

144144
## Using Redis with WordPress
145145

146-
The benefit of enabling Redis Cache to your WordPress application will allow you to deliver content faster since all of the WordPress content is stored in the database. You can cache content that is mostly read only from WordPress database to make the query lookups faster. You can use either of these plugins to setup Redis. Install and enable [Redis PECL extension](https://pecl.php.net/package/redis). See [how to install the extension locally](https://github.com/phpredis/phpredis/blob/develop/INSTALL.md) or [how to install the extension in Azure App Service](../../app-service/configure-language-php.md).
146+
The benefit of enabling Azure Cache for Redis instance to your WordPress application will allow you to deliver content faster since all of the WordPress content is stored in the database. You can cache content that is mostly read only from WordPress database to make the query lookups faster. You can use either of these plugins to setup Redis. Install and enable [Redis PECL extension](https://pecl.php.net/package/redis). See [how to install the extension locally](https://github.com/phpredis/phpredis/blob/develop/INSTALL.md) or [how to install the extension in Azure App Service](../../app-service/configure-language-php.md).
147147

148-
1. [Redis Object cache](https://wordpress.org/plugins/redis-cache/): Install and activate this plugin. Now update the wp-config.php file right above the statement */* That's all, stop editing! Happy blogging. */**
148+
Install [Redis Object cache](https://wordpress.org/plugins/redis-cache/) and activate this plugin on our WordPress application. Now update the `wp-config.php` file right above the statement */* That's all, stop editing! Happy blogging. */**
149149

150150
```php
151151
define( 'WP_REDIS_HOST', 'azure-redis-servername.redis.cache.windows.net' );
@@ -168,9 +168,9 @@ define( 'WP_REDIS_MAXTTL', 60 * 60 * 24 * 7 );
168168

169169
```
170170

171-
Go to the Wordpress admin dashboard and select the Redis settings page on the menu. Now select **enable Object Cache**. Plugin will read the redis server information from wp-config.php file.
171+
Go to the Wordpress admin dashboard and select the Redis settings page on the menu. Now select **enable Object Cache**. Plugin will read the Azure Cache for Redis instance information from `wp-config.php` file.
172172

173-
You may also use [W3 Total cache](https://wordpress.org/plugins/w3-total-cache/) to configure Redis cache on your WordPress app. You can evaluate the performance improvements using [Query Monitor plugin](https://wordpress.org/plugins/query-monitor/), which allows you to debug database queries and it also shows total database queries grouped by a plugin.
173+
You may also use [W3 Total cache](https://wordpress.org/plugins/w3-total-cache/) to configure Azure Cache for Redis on your WordPress app. You can evaluate the performance improvements using [Query Monitor plugin](https://wordpress.org/plugins/query-monitor/), which allows you to debug database queries and it also shows total database queries grouped by a plugin.
174174

175175
## Next steps
176176

0 commit comments

Comments
 (0)