Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.82 KB

File metadata and controls

47 lines (33 loc) · 1.82 KB
page_type languages name description products
sample
javascript
nodejs
Quickstart: Use Azure Cache for Redis in Node.js
Learn how to incorporate Azure Cache for Redis into a Node.js app.
azure
azure-cache-redis

Quickstart: Use Azure Cache for Redis in Node.js

This sample show you how to incorporate Azure Cache for Redis into a Node.js app. See the accompanying article on the documentation site for details, including best practices and how to create the sample code from scratch.

Prerequisites

For examples of using other Node.js clients, see the individual documentation for the Node.js clients listed at Node.js Redis clients.

Set up the working environment

Add environment variables for your cache's HOST NAME and Primary access key. You will use these variables from your code instead of including the sensitive information directly in your code.

set AZURE_CACHE_FOR_REDIS_HOST_NAME=contosoCache.redis.cache.windows.net
set AZURE_CACHE_FOR_REDIS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Run the sample

Download the sample code to your development PC.

Change directories to the folder containing this sample.

Run the script with Node.js.

node redistest.js

References