0

Is it possible to call a predis command outside of transaction context? I mean to exec hget or hexist while a transaction is opened

MrBinWin
  • 1,269
  • 1
  • 16
  • 30

2 Answers2

2

No, it`s not possible. Transaction started with (MULTI) works in per connection pipeline. So you should DISCARD/EXEC first or use another predis connection to Redis server.

Nick Bondarenko
  • 6,211
  • 4
  • 35
  • 56
0

You can do it, but not on the same connection.

Here's a transaction that copies foo2 value to foo, foo2 is read by a second connection:

$responses = $client1->transaction()->set('foo', $client2->get('foo2'))->get('foo')->execute();
Ofir Luzon
  • 10,635
  • 3
  • 41
  • 52