diff options
Diffstat (limited to 'vendor/doctrine/orm/src/Cache/ConcurrentRegion.php')
-rw-r--r-- | vendor/doctrine/orm/src/Cache/ConcurrentRegion.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Cache/ConcurrentRegion.php b/vendor/doctrine/orm/src/Cache/ConcurrentRegion.php new file mode 100644 index 0000000..e9ca870 --- /dev/null +++ b/vendor/doctrine/orm/src/Cache/ConcurrentRegion.php | |||
@@ -0,0 +1,36 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Cache; | ||
6 | |||
7 | /** | ||
8 | * Defines contract for concurrently managed data region. | ||
9 | * It should be able to lock an specific cache entry in an atomic operation. | ||
10 | * | ||
11 | * When a entry is locked another process should not be able to read or write the entry. | ||
12 | * All evict operation should not consider locks, even though an entry is locked evict should be able to delete the entry and its lock. | ||
13 | */ | ||
14 | interface ConcurrentRegion extends Region | ||
15 | { | ||
16 | /** | ||
17 | * Attempts to read lock the mapping for the given key. | ||
18 | * | ||
19 | * @param CacheKey $key The key of the item to lock. | ||
20 | * | ||
21 | * @return Lock|null A lock instance or NULL if the lock already exists. | ||
22 | * | ||
23 | * @throws LockException Indicates a problem accessing the region. | ||
24 | */ | ||
25 | public function lock(CacheKey $key): Lock|null; | ||
26 | |||
27 | /** | ||
28 | * Attempts to read unlock the mapping for the given key. | ||
29 | * | ||
30 | * @param CacheKey $key The key of the item to unlock. | ||
31 | * @param Lock $lock The lock previously obtained from {@link readLock} | ||
32 | * | ||
33 | * @throws LockException Indicates a problem accessing the region. | ||
34 | */ | ||
35 | public function unlock(CacheKey $key, Lock $lock): bool; | ||
36 | } | ||