Issues (28)

src/Cache/RedisCache.php (1 issue)

Labels
Severity
1
<?php declare(strict_types = 1);
2
3
namespace Portiny\Doctrine\Cache;
4
5
use Doctrine\Common\Cache\RedisCache as DoctrineRedisCache;
0 ignored issues
show
The type Doctrine\Common\Cache\RedisCache was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
final class RedisCache extends DoctrineRedisCache
8
{
9
	/**
10
	 * @var string[]
11
	 */
12
	private $prefetchCache = [];
13
14
15
	/**
16
	 * {@inheritdoc}
17
	 */
18
	protected function doContains($id): bool
19
	{
20
		// preload value into local variable becase Doctrine need it if TRUE is returned
21
		$value = $this->doFetch($id);
22
		$this->prefetchCache[$id] = $value;
23
24
		return $value !== false;
25
	}
26
27
28
	/**
29
	 * {@inheritdoc}
30
	 */
31
	protected function doFetch($id)
32
	{
33
		// try load value from prefetch cache
34
		$doFetch = $this->prefetchCache[$id] ?? null;
35
		$this->prefetchCache = [];
36
37
		if ($doFetch === null) {
38
			$doFetch = parent::doFetch($id);
39
		}
40
41
		return $doFetch;
42
	}
43
44
}
45