title: How push to store data in Redis for Custom Map?
body: <p>I'm storing Data in Map and Fetching the Field values now instead of Map I want to store data in Redis. I'm new to Redis and using below code to store in Redis :</p>
  
  <pre><code> public class CachingRedis {
  private static HashMap&lt;String, UserFields&gt; Cache;
  private static JedisPool pool = null;
  private static final String redisHost = "localhost";
  private static final Integer redisPort = 6379;
  static Jedis jedis = null;
  static User u;
  
  public CachingRedis() {
      pool = new JedisPool(redisHost, redisPort);
      this.Cache = new HashMap&lt;String, UserFields&gt;();
  
  }
  
  public static void main(String[] args) throws ExecutionException {
  
      CachingRedis gt = new CachingRedis();
      gt.addSets();
  
  }
  
  private void addSets() {
      InputStream in = ClassLoader.class.getResourceAsStream("/users.csv"); 
      u = new User(in);
      String[] consideredUserFields = { "Area","FirstName","LastName","Contact","Level"};
      List&lt;String[]&gt; users = p.getUsers();
      jedis = pool.getResource();
      int count1 = 0;
      String token = null;
      String fieldName = null;
      String fieldVal = null;
  
      for (int i = 0; i &lt; users.size(); i++) {
          UserFields uFields = new UserFields();
          String tmpId = Integer.toString(p.getUserId(i));
          String[] tmpFields = Users.get(i);
          for (int j = 0; j &lt; tmpFields.length; j++) {
  
              fieldName = consideredUsersFields[j];
              fieldVal = tmpFields[j];
  
              if (Cache != null &amp;&amp; Cache.containsKey(tmpId)) {
                  uFields = Cache.get(tmpId);
                  uFields.setFieldKeyValues(fieldName, fieldVal);
                  Cache.put(tmpId, uFields);
                   **jedis.hsetnx( tmpId,fieldName,fieldVal );**
              } else {
                  uFields.setFieldKeyValues(fieldName, fieldVal);
  
                  Cache.put(tmpId, pFields);
                  **jedis.hsetnx( tmpId,fieldName,fieldVal );**
              }
  
          }
      }
  
      }  }
  </code></pre>
  
  <p>I'm getting the following error</p>
  
  <pre><code>Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of       value
  at redis.clients.jedis.Protocol.processError(Protocol.java:117)
  at redis.clients.jedis.Protocol.process(Protocol.java:142)
  at redis.clients.jedis.Protocol.read(Protocol.java:196)
  at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:288)
  at redis.clients.jedis.Connection.getIntegerReply(Connection.java:213)
  at redis.clients.jedis.Jedis.lpush(Jedis.java:814)
  at net.cintell.CachingRedis.addSets(CachingRedis.java:85)
  at net.cintell.CachingRedis.main(CachingRedis.java:48)
  </code></pre>
  
  <p>Can anyone tell where I am doing wrong? I want to store the csv file into redis and fetch respective fields?</p>