File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ import redis.clients.jedis.Jedis;
2+ import redis.clients.jedis.Pipeline;
3+ import redis.clients.jedis.Response;
4+ import redis.clients.jedis.Transaction;
5+ import redis.clients.jedis.exceptions.JedisDataException;
6+
7+
8+ Transaction t = jedis.multi();
9+
10+ Response<Long> hsetResponse = t.hset(statusKey, "available", "true");
11+ Response<Long> expireResponse = t.expire(statusKey, 1000);
12+ Response<Long> saddResponse = t.sadd(availableKey,
13+ String.valueOf(siteId));
14+
15+ t.exec();
16+ // !!! IMPORTANT
17+ // if something wrong with operation - exception will be thrown during Response.get()
18+
19+ assertThat(hsetResponse.get(), is(1L));
20+ assertThat(expireResponse.get(), is(1L));
21+ assertThat(saddResponse.get(), is(1L));
22+
You can’t perform that action at this time.
0 commit comments