java - Getting values with jedis pipeline -


i have list of ids want use retrieve hashes redis server using java client jedis. mentioned in documentation, jedis provides way use pipeline declaring response objects , sync pipeline values:

pipeline p = jedis.pipelined(); p.set("fool", "bar");  p.zadd("foo", 1, "barowitch");  p.zadd("foo", 0, "barinsky"); p.zadd("foo", 0, "barikoviev"); response<string> pipestring = p.get("fool"); response<set<string>> sose = p.zrange("foo", 0, -1); p.sync();  

however, list has variable length keeps changing every few minutes. thus, not able predict number of response objects need declare. there way around that, like:

pipeline p = jedis.pipelined(); response<list<list<map<string,string>>> records; (int id: ids)     records.add(p.hgetall(id)) p.sync(); 

i guess want achive done this.

list<response> responses = new arraylist<>();  pipeline p = jedis.pipelined(); (int id: ids) { records.add(p.get(id)); } p.sync();  for(reponse response : responses){ object o = response.get(); } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -