|
2 | 2 | [](https://packagist.org/packages/cheprasov/php-redis-lock)
|
3 | 3 | [](https://packagist.org/packages/cheprasov/php-redis-lock)
|
4 | 4 |
|
5 |
| -# RedisLock v1.0.1 for PHP >= 5.5 |
| 5 | +# RedisLock v1.0.2 for PHP >= 5.5 |
6 | 6 |
|
7 | 7 | ## About
|
8 | 8 | RedisLock for PHP is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. A lock is designed to enforce a mutual exclusion concurrency control policy. Based on [redis](http://redis.io/).
|
@@ -57,7 +57,7 @@ $Redis = ClientFactory::create([
|
57 | 57 | */
|
58 | 58 | function updateJsonInRedis(RedisClient $Redis, $key, array $array) {
|
59 | 59 | // Create new Lock instance
|
60 |
| - $Lock = new RedisLock($Redis, 'Lock_'.$key, RedisLock::FLAG_CATCH_EXCEPTIONS); |
| 60 | + $Lock = new RedisLock($Redis, 'Lock_'.$key, RedisLock::FLAG_DO_NOT_THROW_EXCEPTIONS); |
61 | 61 |
|
62 | 62 | // Acquire lock for 2 sec.
|
63 | 63 | // If lock has acquired in another thread then we will wait 3 second,
|
@@ -102,22 +102,22 @@ Create a new instance of RedisLock.
|
102 | 102 | 1. RedisClient **$Redis** - Instanse of [RedisClient](https://github.com/cheprasov/php-redis-client)
|
103 | 103 | 2. string **$key** - name of key in Redis storage. Only locks with the same name will compete with each other for lock.
|
104 | 104 | 3. int **$flags**, default = 0
|
105 |
| - * `RedisLock::FLAG_CATCH_EXCEPTIONS` - use this flag, if you don't want catch exceptions by yourself. Do not use this flag, if you want have a full control on situation with locks. Default behavior without this flag - all Exceptions will be thrown. |
| 105 | + * `RedisLock::FLAG_DO_NOT_THROW_EXCEPTIONS` - use this flag, if you don't want catch exceptions by yourself. Do not use this flag, if you want have a full control on situation with locks. Default behavior without this flag - all Exceptions will be thrown. |
106 | 106 |
|
107 | 107 | ##### Example
|
108 | 108 |
|
109 | 109 | ```php
|
110 | 110 | $Lock = new RedisLock($Redis, 'lockName');
|
111 | 111 | // or
|
112 |
| -$Lock = new RedisLock($Redis, 'lockName', RedisLock::FLAG_CATCH_EXCEPTIONS); |
| 112 | +$Lock = new RedisLock($Redis, 'lockName', RedisLock::FLAG_DO_NOT_THROW_EXCEPTIONS); |
113 | 113 |
|
114 | 114 | ```
|
115 | 115 |
|
116 | 116 | #### `bool` RedisLock :: acquire ( `int|float` **$lockTime** , [ `float` **$waitTime** = 0 [, `float` **$sleep** = 0.005 ] ] )
|
117 | 117 | ---
|
118 | 118 | Try to acquire lock for `$lockTime` seconds.
|
119 | 119 | If lock has acquired in another thread then we will wait `$waitTime` seconds, until another thread release the lock.
|
120 |
| -Otherwise method throws a exception (if `FLAG_CATCH_EXCEPTIONS` is not set) or result. |
| 120 | +Otherwise method throws a exception (if `FLAG_DO_NOT_THROW_EXCEPTIONS` is not set) or result. |
121 | 121 | Returns `true` on success or `false` on failure.
|
122 | 122 |
|
123 | 123 | ##### Method Pameters
|
|
0 commit comments