-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathCacheSelector.php
More file actions
34 lines (26 loc) · 700 Bytes
/
CacheSelector.php
File metadata and controls
34 lines (26 loc) · 700 Bytes
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
<?php
declare(strict_types=1);
namespace Nette\Caching;
class CacheSelector
{
private array $conditions;
/**
* Adds where condition, more calls appends with AND.
* Pass tags as array to append with OR.
*
* Example:
* (new CacheSelector())->where("animal")->where("dog")->where(["brown", "white"])
* Creates condition looking for entities having tags animal and dog and (brown / white). Will not match entity, tagged animal, dog, black.
*
* @param string|array $tags tag names to select
*/
public function where(string|array $tags): static
{
$this->conditions[] = $tags;
return $this;
}
public function getConditions(): array
{
return $this->conditions;
}
}