Last active
August 29, 2015 14:14
-
-
Save rustd/33ac3181a6a20f8460f4 to your computer and use it in GitHub Desktop.
Use Jedis client to connet to Azure Redis Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycompany.app; | |
import redis.clients.jedis.Jedis; | |
import redis.clients.jedis.JedisShardInfo; | |
/** | |
* Make sure your turn on non SSL port in Azure Redis using the Configuration section in the Azure portal. | |
* Hello world! | |
* mvn compile | |
* mvn exec:java | |
*/ | |
public class App | |
{ | |
public static void main( String[] args ) | |
{ | |
System.out.println( "Hello World!" ); | |
JedisShardInfo shardInfo = new JedisShardInfo("enteryourcachename.redis.cache.windows.net", 6379); | |
shardInfo.setPassword("enteryourpassword"); | |
Jedis jedis = new Jedis(shardInfo); | |
for(int i=0 ; i < 5 ; i++) | |
{ | |
jedis.set(""+i, ""+i); | |
String value = jedis.get(""+i); | |
System.out.println("value="+ value ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment