Add data to redis - Java Big Data

Java examples for Big Data:Redis

Description

Add data to redis

Demo Code



import redis.clients.jedis.Jedis;

public class Redis {

  public static void main(String[] args) {
    Jedis jedis = new Jedis("localhost",6379);
    System.out.println("Connect to redis successfully!");
    //from w w  w .j a v  a  2s. c  o m
    System.out.println("Jedis pings: "+jedis.ping());
    
    jedis.set("name", "lipanpan");
    jedis.append("name", " is my lover!");
    String jrs = jedis.get("name");
    System.out.println(jrs);
  }

}

Related Tutorials