Skip to content

Commit 21fb69d

Browse files
committed
ICM: redis strategy implemented.
1 parent 7d3e2f3 commit 21fb69d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Mutex.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
use Illuminate\Console\Command;
66
use NinjaMutex\Lock\FlockLock;
77
use NinjaMutex\Lock\MySqlLock;
8+
use NinjaMutex\Lock\PredisRedisLock;
89
use NinjaMutex\Mutex as Ninja;
910
use NinjaMutex\MutexException;
11+
use Redis;
1012

1113
class Mutex
1214
{
@@ -32,7 +34,7 @@ private function strategy()
3234
return new MySqlLock(env('DB_USERNAME'), env('DB_PASSWORD'), env('DB_HOST'));
3335

3436
case 'redis':
35-
throw new MutexException('Strategy `redis` is not implemented yet.');
37+
return new PredisRedisLock(Redis::connection());
3638

3739
case 'memcache':
3840
throw new MutexException('Strategy `memcache` is not implemented yet.');

0 commit comments

Comments
 (0)