File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
5
5
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## 1.0.0
8
+ ### Changed
9
+ - ` \Paysera\Bundle\LockBundle\Service\LockManager::createLock ` now creates lock without TTL
10
+ - Added strict type declaration in ` \Paysera\Bundle\LockBundle\Service\LockManager `
11
+ - Updated README.md
12
+
7
13
## 0.2.1
8
14
### Changed
9
15
- ` PayseraLockExtension ` Definition method ** setArgument** is replaced to ** replaceArgument** so bundle will work properly on Symfony ^2.8
Original file line number Diff line number Diff line change 3
3
Provides quick integration with ` symfony/lock `
4
4
5
5
### Installation
6
+ - Install package
6
7
``` bash
7
8
composer require paysera/lib-lock-bundle
8
9
```
10
+ - Enable bundle
11
+ ``` php
12
+ class AppKernel extends Kernel
13
+ {
14
+ public function registerBundles()
15
+ {
16
+ $bundles = [
17
+ // ...
18
+ new Paysera\Bundle\LockBundle\PayseraLockBundle(),
19
+ ];
20
+
21
+ // ...
22
+ }
23
+ }
24
+ ```
9
25
10
26
### Configuration
11
27
``` yaml
@@ -30,13 +46,13 @@ paysera_lock:
30
46
$lock = $this->lockManager->createLock($identifier);
31
47
try {
32
48
$this->lockManager->acquire($lock);
49
+
50
+ // do something after aquiring lock
33
51
} catch (LockAcquiringException $exception) {
34
52
throw new Exception('...');
53
+ } finally {
54
+ $lock->release();
35
55
}
36
-
37
- // do something when got lock
38
-
39
- $lock->release();
40
56
` ` `
41
57
OR
42
58
` ` ` php
47
63
}
48
64
49
65
// do rest
50
-
51
66
` ` `
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ declare (strict_type=1 );
4
+
3
5
namespace Paysera \Bundle \LockBundle \Service ;
4
6
5
7
use Symfony \Component \Lock \Exception \LockAcquiringException ;
@@ -21,7 +23,7 @@ public function __construct(
21
23
22
24
public function createLock (string $ resource ): LockInterface
23
25
{
24
- return $ this ->lockFactory ->createLock ($ resource , $ this -> ttl );
26
+ return $ this ->lockFactory ->createLock ($ resource , null );
25
27
}
26
28
27
29
public function acquire (LockInterface $ lock ): bool
You can’t perform that action at this time.
0 commit comments