1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace BEAR\QueryRepository; |
6
|
|
|
|
7
|
|
|
use BEAR\RepositoryModule\Annotation\EtagPool; |
8
|
|
|
use Memcached; |
9
|
|
|
use Psr\Cache\CacheItemPoolInterface; |
10
|
|
|
use Ray\Di\AbstractModule; |
11
|
|
|
use Ray\PsrCacheModule\Annotation\CacheNamespace; |
12
|
|
|
use Ray\PsrCacheModule\Annotation\MemcacheConfig; |
13
|
|
|
use Ray\PsrCacheModule\MemcachedProvider; |
14
|
|
|
use Ray\PsrCacheModule\Psr6RedisModule; |
15
|
|
|
use Symfony\Component\Cache\Adapter\MemcachedAdapter; |
16
|
|
|
|
17
|
|
|
use function array_map; |
18
|
|
|
use function explode; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Bind redis to shared storage, Bind memcache to etag pool |
22
|
|
|
*/ |
23
|
|
|
final class StorageRedisMemcachedModule extends AbstractModule |
24
|
|
|
{ |
25
|
|
|
/** @var string */ |
26
|
|
|
private $redisServer; |
27
|
|
|
|
28
|
|
|
/** @var list<list<string>> */ |
|
|
|
|
29
|
|
|
private $memcacheServer; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param string $redisServer 'localhost:6379' {host}:{port} |
33
|
|
|
*/ |
34
|
|
|
public function __construct(string $redisServer, string $memcacheServer, ?AbstractModule $module = null) |
35
|
|
|
{ |
36
|
|
|
$this->redisServer = $redisServer; |
37
|
|
|
$this->memcacheServer = array_map(static function ($memcacheServer) { |
|
|
|
|
38
|
|
|
return explode(':', $memcacheServer); |
39
|
|
|
}, explode(',', $memcacheServer)); |
40
|
|
|
parent::__construct($module); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
|
|
protected function configure(): void |
47
|
|
|
{ |
48
|
|
|
$this->install(new Psr6RedisModule($this->redisServer)); |
49
|
|
|
$this->bind(CacheItemPoolInterface::class)->annotatedWith(EtagPool::class)->toConstructor(MemcachedAdapter::class, [ |
50
|
|
|
'namespace' => CacheNamespace::class, |
51
|
|
|
]); |
52
|
|
|
$this->bind()->annotatedWith(MemcacheConfig::class)->toInstance($this->memcacheServer); |
53
|
|
|
$this->bind(Memcached::class)->toProvider(MemcachedProvider::class); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths