Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

Put data with Redisson and Get with Jedis

$
0
0

I am new to Redis and have a scenario to put data to Redis using Redisson and get using Jedis (and vice versa). The data I am trying to maintain is Map<String, String>.

For this I am using HGET API of Jedis and RMap/RLocalCachedMap object of Redisson.

Logic to Put:

public static String putData(String hash, String key, String value) throws Exception {        RMap<String, String> map = client.getMap(hash);        String previousValue = null;        previousValue = map.put(key, value);            return previousValue;    }

Logic to Get:

public static String getFromHash(String hash, String key) {        Jedis jedis = jedisPool.getResource();        String value = jedis.hget(hash,key);        jedis.close();        return value;    }

What I see is the after persisting the data (using Redisson), we are able to retrieve in Redisson client but we get null when we try to retrieve this object in Jedis.

Questions:

  1. Does Redisson RMap object not translate to HSET in Redis?
  2. If it does, can someone please suggest on what am I doing wrong here.

Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>