I am implementing a simple redis command using jedis in java. The redis-cli command is:
hmset myhash key "value1" field2 "value2" field3 "value3"
The problem is that jedis
's hmset
method requires two parameters:
String key
Map <String, String> hash
Possible solution:
String key;
String value2;
String value3;
while(!toVisit.isEmpty()) {
key = someQueue.poll()
value2 = getTitle(key)
value3 = getSize(value2)
jedis.hmset(key, value2Map)
jedis.hmset(key, value3Map)
...
But it feels a bit counter-intuitive having to implement three Tree Map objects to get their last added object in order to add a tuple with three fields in the redis db.
Just hoping for some better ideas before going ahead and implementing this.