1 | <?php |
||
19 | protected bool $enabled = false; |
||
|
|||
20 | |||
21 | /** |
||
22 | * Default lifetime |
||
23 | */ |
||
24 | protected int $defaultLifetime = 3600; |
||
25 | |||
26 | /** |
||
27 | * Default lock lifetime |
||
28 | */ |
||
29 | protected int $defaultLockLifetime = 60; |
||
30 | |||
31 | /** |
||
32 | * The file lock region directory (needed for some cache usage) |
||
33 | */ |
||
34 | protected string $fileLockRegionDirectory = ''; |
||
35 | |||
36 | /** |
||
37 | * Configure the lifetime and lock lifetime per region. You must pass an associative array like this: |
||
38 | * |
||
39 | * [ |
||
40 | * 'My\Region' => ['lifetime' => 200, 'lock_lifetime' => 400], |
||
41 | * ] |
||
42 | * |
||
43 | * @var mixed[] |
||
44 | */ |
||
45 | protected array $regions = []; |
||
46 | |||
47 | public function setEnabled(bool $enabled) : void |
||
48 | { |
||
49 | $this->enabled = (bool) $enabled; |
||
50 | } |
||
51 | |||
52 | public function isEnabled() : bool |
||
53 | { |
||
54 | return $this->enabled; |
||
55 | } |
||
56 | |||
57 | public function setDefaultLifetime(int $defaultLifetime) : void |
||
58 | { |
||
59 | $this->defaultLifetime = (int) $defaultLifetime; |
||
60 | } |
||
61 | |||
62 | public function getDefaultLifetime() : int |
||
63 | 1 | { |
|
64 | return $this->defaultLifetime; |
||
65 | 1 | } |
|
66 | 1 | ||
67 | public function setDefaultLockLifetime(int $defaultLockLifetime) : void |
||
68 | { |
||
69 | $this->defaultLockLifetime = (int) $defaultLockLifetime; |
||
70 | } |
||
71 | 86 | ||
72 | public function getDefaultLockLifetime() : int |
||
73 | 86 | { |
|
74 | return $this->defaultLockLifetime; |
||
75 | } |
||
76 | |||
77 | public function setFileLockRegionDirectory(string $fileLockRegionDirectory) : void |
||
78 | { |
||
79 | 1 | $this->fileLockRegionDirectory = (string) $fileLockRegionDirectory; |
|
80 | } |
||
81 | 1 | ||
82 | 1 | public function getFileLockRegionDirectory() : string |
|
83 | { |
||
84 | return $this->fileLockRegionDirectory; |
||
85 | } |
||
86 | |||
87 | 1 | /** |
|
88 | * @param mixed[] $regions |
||
89 | 1 | */ |
|
90 | public function setRegions(array $regions) : void |
||
91 | { |
||
92 | $this->regions = $regions; |
||
93 | } |
||
94 | |||
95 | 1 | /** |
|
96 | * @return mixed[] |
||
97 | 1 | */ |
|
98 | 1 | public function getRegions() : array |
|
99 | { |
||
100 | return $this->regions; |
||
101 | } |
||
102 | } |
||
103 |