mmeyer2k / predis-multi
A closure wrapper for predis transactions
1.0.1
2019-12-17 20:01 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-11-29 05:57:24 UTC
README
Finally, a closure wrapper for predis transactions.
Install
composer require mmeyer2k/predis-multi
Use
Basic example of simply incrementing key:
use \mmeyer2k\PredisMulti\PredisMulti; $redis = new \Predis\Client(); $multi = PredisMulti::exec($redis, function() { $redis->incr('key'); $redis->incr('key'); $redis->incr('key'); }); # $multi = [1, 2, 3]
Rollback transaction by returning false from the closure.
$multi = PredisMulti::exec($redis, function() { $redis->touch('this-key-will-never-be-created'); return false; });