page_type | languages | name | description | products | |||
---|---|---|---|---|---|---|---|
sample |
|
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. |
|
This sample show you how to incorporate Azure Cache for Redis into a Java app using the Redisson Redis client.
- Azure subscription - create one for free
- Azure Cache for Redis cache - create one
- Apache Maven
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.
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