1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | package test.redis; import redis.clients.jedis.Jedis; /* * ************************************************************************************ * * RedisStringTest.java * * ************************************************************************************ * * @version 1.0.00 2017-02-10 dorbae Initialize * @since 2017-02-10 * @author dorbae * * ************************************************************************************ */ public class RedisStringTest { public RedisStringTest() { // TODO Auto-generated constructor stub } public static void main(String[] args) { //Connecting to Redis server on localhost Jedis jedis = new Jedis("btcxen.esb.broker1"); System.out.println("Connection to server sucessfully"); //set the data in redis string jedis.set("tutorial-name", "Redis tutorial"); // Get the stored data and print it System.out.println("Stored string in redis:: "+ jedis.get("tutorial-name")); } } |
Thursday, 16 February 2017
[Redis] Set/Get Key//Value in Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment