diff options
Diffstat (limited to 'vendor/doctrine/orm/src/Cache/RegionsConfiguration.php')
-rw-r--r-- | vendor/doctrine/orm/src/Cache/RegionsConfiguration.php | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Cache/RegionsConfiguration.php b/vendor/doctrine/orm/src/Cache/RegionsConfiguration.php new file mode 100644 index 0000000..a852831 --- /dev/null +++ b/vendor/doctrine/orm/src/Cache/RegionsConfiguration.php | |||
@@ -0,0 +1,63 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Cache; | ||
6 | |||
7 | /** | ||
8 | * Cache regions configuration | ||
9 | */ | ||
10 | class RegionsConfiguration | ||
11 | { | ||
12 | /** @var array<string,int> */ | ||
13 | private array $lifetimes = []; | ||
14 | |||
15 | /** @var array<string,int> */ | ||
16 | private array $lockLifetimes = []; | ||
17 | |||
18 | public function __construct( | ||
19 | private int $defaultLifetime = 3600, | ||
20 | private int $defaultLockLifetime = 60, | ||
21 | ) { | ||
22 | } | ||
23 | |||
24 | public function getDefaultLifetime(): int | ||
25 | { | ||
26 | return $this->defaultLifetime; | ||
27 | } | ||
28 | |||
29 | public function setDefaultLifetime(int $defaultLifetime): void | ||
30 | { | ||
31 | $this->defaultLifetime = $defaultLifetime; | ||
32 | } | ||
33 | |||
34 | public function getDefaultLockLifetime(): int | ||
35 | { | ||
36 | return $this->defaultLockLifetime; | ||
37 | } | ||
38 | |||
39 | public function setDefaultLockLifetime(int $defaultLockLifetime): void | ||
40 | { | ||
41 | $this->defaultLockLifetime = $defaultLockLifetime; | ||
42 | } | ||
43 | |||
44 | public function getLifetime(string $regionName): int | ||
45 | { | ||
46 | return $this->lifetimes[$regionName] ?? $this->defaultLifetime; | ||
47 | } | ||
48 | |||
49 | public function setLifetime(string $name, int $lifetime): void | ||
50 | { | ||
51 | $this->lifetimes[$name] = $lifetime; | ||
52 | } | ||
53 | |||
54 | public function getLockLifetime(string $regionName): int | ||
55 | { | ||
56 | return $this->lockLifetimes[$regionName] ?? $this->defaultLockLifetime; | ||
57 | } | ||
58 | |||
59 | public function setLockLifetime(string $name, int $lifetime): void | ||
60 | { | ||
61 | $this->lockLifetimes[$name] = $lifetime; | ||
62 | } | ||
63 | } | ||