我正在使用redis,并且希望将更多具有相同ID的项目插入到我的表格中。 这是我在Java代码中插入项排序set和哈希在Redis的:在Redis中插入更多具有相同ID的项目到哈希中
Jedis jedis = new Jedis("localhost");
jedis.sadd("list"+customer,fur.getId());
jedis.hset("list"+customer+fur.getId(),"name", fur.getName());
jedis.hset("list"+customer+fur.getId(), "wood", fur.getWood());
jedis.hset("list"+customer+fur.getId(), "prize", fur.getPric());
然后我让他们从Redis的到我的JTable:
p = jedis.smembers("tutorials"+customer);
for (String v : p) {
String pom;
pom = v;
model.addRow(new Object[]{jedis.hget("list"+customer+pom, "name"),
jedis.hget("list"+customer+pom, "wood"),
jedis.hget("list"+customer+pom, "prize")});
}
它的工作,但是当我想要多次添加相同的项目,它没有做任何事情。