Azure Redis Cache modules for JavaScript

Azure Redis Cache is based on the popular open-source Redis project. It gives you access to a secure, dedicated Redis instance, managed by Microsoft and accessible from your Azure apps.

Redis is an advanced key-value store, where keys can contain data structures such as strings, hashes, lists, sets, and sorted sets. Redis supports a set of atomic operations on these data types.

Learn more about Azure Redis Cache.

Client package

Install the npm module

Use npm to install the Redis module for JavaScript

npm install redis

Example

This example connects to an Azure Redis Cache instance, stores a key/value pair and then reads the stored value by its key.

const redis = require('redis');

async function sample() 
{
    var client = redis.createClient(
    {
        // rediss for TLS
        url: "rediss://<name>.redis.cache.windows.net:6380",
        password: "<key>",
    });
    await client.connect();

    console.log(await client.set('key1', 'value'));
    console.log(await client.get('key1'));
    console.log("\nDone");
    process.exit();
}
sample();

Management package

Install the npm module for Azure Cache for Redis

Use npm to install the Azure Cache for Redis modules for JavaScript

npm install @azure/arm-rediscache

Samples

For more code samples that use various Azure packages, explore the JavaScript samples