summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Cache/Logging/CacheLoggerChain.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/src/Cache/Logging/CacheLoggerChain.php')
-rw-r--r--vendor/doctrine/orm/src/Cache/Logging/CacheLoggerChain.php94
1 files changed, 94 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Cache/Logging/CacheLoggerChain.php b/vendor/doctrine/orm/src/Cache/Logging/CacheLoggerChain.php
new file mode 100644
index 0000000..8eef3b5
--- /dev/null
+++ b/vendor/doctrine/orm/src/Cache/Logging/CacheLoggerChain.php
@@ -0,0 +1,94 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Cache\Logging;
6
7use Doctrine\ORM\Cache\CollectionCacheKey;
8use Doctrine\ORM\Cache\EntityCacheKey;
9use Doctrine\ORM\Cache\QueryCacheKey;
10
11class CacheLoggerChain implements CacheLogger
12{
13 /** @var array<string, CacheLogger> */
14 private array $loggers = [];
15
16 public function setLogger(string $name, CacheLogger $logger): void
17 {
18 $this->loggers[$name] = $logger;
19 }
20
21 public function getLogger(string $name): CacheLogger|null
22 {
23 return $this->loggers[$name] ?? null;
24 }
25
26 /** @return array<string, CacheLogger> */
27 public function getLoggers(): array
28 {
29 return $this->loggers;
30 }
31
32 public function collectionCacheHit(string $regionName, CollectionCacheKey $key): void
33 {
34 foreach ($this->loggers as $logger) {
35 $logger->collectionCacheHit($regionName, $key);
36 }
37 }
38
39 public function collectionCacheMiss(string $regionName, CollectionCacheKey $key): void
40 {
41 foreach ($this->loggers as $logger) {
42 $logger->collectionCacheMiss($regionName, $key);
43 }
44 }
45
46 public function collectionCachePut(string $regionName, CollectionCacheKey $key): void
47 {
48 foreach ($this->loggers as $logger) {
49 $logger->collectionCachePut($regionName, $key);
50 }
51 }
52
53 public function entityCacheHit(string $regionName, EntityCacheKey $key): void
54 {
55 foreach ($this->loggers as $logger) {
56 $logger->entityCacheHit($regionName, $key);
57 }
58 }
59
60 public function entityCacheMiss(string $regionName, EntityCacheKey $key): void
61 {
62 foreach ($this->loggers as $logger) {
63 $logger->entityCacheMiss($regionName, $key);
64 }
65 }
66
67 public function entityCachePut(string $regionName, EntityCacheKey $key): void
68 {
69 foreach ($this->loggers as $logger) {
70 $logger->entityCachePut($regionName, $key);
71 }
72 }
73
74 public function queryCacheHit(string $regionName, QueryCacheKey $key): void
75 {
76 foreach ($this->loggers as $logger) {
77 $logger->queryCacheHit($regionName, $key);
78 }
79 }
80
81 public function queryCacheMiss(string $regionName, QueryCacheKey $key): void
82 {
83 foreach ($this->loggers as $logger) {
84 $logger->queryCacheMiss($regionName, $key);
85 }
86 }
87
88 public function queryCachePut(string $regionName, QueryCacheKey $key): void
89 {
90 foreach ($this->loggers as $logger) {
91 $logger->queryCachePut($regionName, $key);
92 }
93 }
94}