summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Cache/CacheConfiguration.php
blob: 0f8dea7682a337d312539418b744fb0f9648af59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Cache;

use Doctrine\ORM\Cache\Logging\CacheLogger;

/**
 * Configuration container for second-level cache.
 */
class CacheConfiguration
{
    private CacheFactory|null $cacheFactory          = null;
    private RegionsConfiguration|null $regionsConfig = null;
    private CacheLogger|null $cacheLogger            = null;
    private QueryCacheValidator|null $queryValidator = null;

    public function getCacheFactory(): CacheFactory|null
    {
        return $this->cacheFactory;
    }

    public function setCacheFactory(CacheFactory $factory): void
    {
        $this->cacheFactory = $factory;
    }

    public function getCacheLogger(): CacheLogger|null
    {
         return $this->cacheLogger;
    }

    public function setCacheLogger(CacheLogger $logger): void
    {
        $this->cacheLogger = $logger;
    }

    public function getRegionsConfiguration(): RegionsConfiguration
    {
        return $this->regionsConfig ??= new RegionsConfiguration();
    }

    public function setRegionsConfiguration(RegionsConfiguration $regionsConfig): void
    {
        $this->regionsConfig = $regionsConfig;
    }

    public function getQueryValidator(): QueryCacheValidator
    {
        return $this->queryValidator ??= new TimestampQueryCacheValidator(
            $this->cacheFactory->getTimestampRegion(),
        );
    }

    public function setQueryValidator(QueryCacheValidator $validator): void
    {
        $this->queryValidator = $validator;
    }
}