DISCARD without MULTI

731 views
Skip to first unread message

Gabriel Ki

unread,
May 2, 2012, 5:42:33 PM5/2/12
to Jedis
Hi everyone,

I am not understanding this exception from the code below.

jedis.watch(key);
String value = jedis.get(key);
Transaction t = jedis.multi();
// do something on value and hm... I change my mind
t.discard();


redis.clients.jedis.exceptions.JedisDataException: ERR DISCARD without MULTI
    at redis.clients.jedis.Protocol.processError(Protocol.java:55)
    at redis.clients.jedis.Protocol.process(Protocol.java:62)
    at redis.clients.jedis.Protocol.read(Protocol.java:127)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:162)
    at redis.clients.jedis.BinaryTransaction.discard(BinaryTransaction.java:61)



Is this different from http://redis.io/commands/discard ?  Is there any recommendation for a better flow?

Thanks,
-gabe




Reply all
Reply to author
Forward
0 new messages