Skip to content

Latest commit

 

History

History
 
 

java-redisson

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
page_type languages name description products
sample
java
Quickstart: Use Azure Cache for Redis in Java with Redisson Redis client
Learn how to incorporate Azure Cache for Redis into a Java app using the Redisson Redis client.
azure
azure-cache-redis

Quickstart: Use Azure Cache for Redis in Java with Redisson Redis client

This sample show you how to incorporate Azure Cache for Redis into a Java app using the Redisson Redis client.

Prerequisites

Set up the working environment

Depending on your operating system, add environment variables for your cache's Host name and Primary access key. Open a command prompt, or a terminal window, and set up the following values:

set REDISCACHEHOSTNAME=<YOUR_HOST_NAME>.redis.cache.windows.net
set REDISCACHEKEY=<YOUR_PRIMARY_ACCESS_KEY>
export REDISCACHEHOSTNAME=<YOUR_HOST_NAME>.redis.cache.windows.net
export REDISCACHEKEY=<YOUR_PRIMARY_ACCESS_KEY>

Replace the placeholders with the following values:

  • <YOUR_HOST_NAME>: The DNS host name, obtained from the Properties section of your Azure Cache for Redis resource in the Azure portal.
  • <YOUR_PRIMARY_ACCESS_KEY>: The primary access key, obtained from the Access keys section of your Azure Cache for Redis resource in the Azure portal.

Run the sample

Download the sample code to your development PC.

Change directories to the folder containing this sample.

Execute the following Maven command to build and run the app:

mvn compile exec:java -D exec.mainClass=example.demo.App