summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/src/Cache.php')
-rw-r--r--vendor/doctrine/orm/src/Cache.php106
1 files changed, 106 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Cache.php b/vendor/doctrine/orm/src/Cache.php
new file mode 100644
index 0000000..8020b27
--- /dev/null
+++ b/vendor/doctrine/orm/src/Cache.php
@@ -0,0 +1,106 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM;
6
7use Doctrine\ORM\Cache\QueryCache;
8use Doctrine\ORM\Cache\Region;
9
10/**
11 * Provides an API for querying/managing the second level cache regions.
12 */
13interface Cache
14{
15 public const DEFAULT_QUERY_REGION_NAME = 'query_cache_region';
16
17 public const DEFAULT_TIMESTAMP_REGION_NAME = 'timestamp_cache_region';
18
19 /**
20 * May read items from the cache, but will not add items.
21 */
22 public const MODE_GET = 1;
23
24 /**
25 * Will never read items from the cache,
26 * but will add items to the cache as it reads them from the database.
27 */
28 public const MODE_PUT = 2;
29
30 /**
31 * May read items from the cache, and add items to the cache.
32 */
33 public const MODE_NORMAL = 3;
34
35 /**
36 * The query will never read items from the cache,
37 * but will refresh items to the cache as it reads them from the database.
38 */
39 public const MODE_REFRESH = 4;
40
41 public function getEntityCacheRegion(string $className): Region|null;
42
43 public function getCollectionCacheRegion(string $className, string $association): Region|null;
44
45 /**
46 * Determine whether the cache contains data for the given entity "instance".
47 */
48 public function containsEntity(string $className, mixed $identifier): bool;
49
50 /**
51 * Evicts the entity data for a particular entity "instance".
52 */
53 public function evictEntity(string $className, mixed $identifier): void;
54
55 /**
56 * Evicts all entity data from the given region.
57 */
58 public function evictEntityRegion(string $className): void;
59
60 /**
61 * Evict data from all entity regions.
62 */
63 public function evictEntityRegions(): void;
64
65 /**
66 * Determine whether the cache contains data for the given collection.
67 */
68 public function containsCollection(string $className, string $association, mixed $ownerIdentifier): bool;
69
70 /**
71 * Evicts the cache data for the given identified collection instance.
72 */
73 public function evictCollection(string $className, string $association, mixed $ownerIdentifier): void;
74
75 /**
76 * Evicts all entity data from the given region.
77 */
78 public function evictCollectionRegion(string $className, string $association): void;
79
80 /**
81 * Evict data from all collection regions.
82 */
83 public function evictCollectionRegions(): void;
84
85 /**
86 * Determine whether the cache contains data for the given query.
87 */
88 public function containsQuery(string $regionName): bool;
89
90 /**
91 * Evicts all cached query results under the given name, or default query cache if the region name is NULL.
92 */
93 public function evictQueryRegion(string|null $regionName = null): void;
94
95 /**
96 * Evict data from all query regions.
97 */
98 public function evictQueryRegions(): void;
99
100 /**
101 * Get query cache by region name or create a new one if none exist.
102 *
103 * @param string|null $regionName Query cache region name, or default query cache if the region name is NULL.
104 */
105 public function getQueryCache(string|null $regionName = null): QueryCache;
106}