1 | <?php |
||
36 | class FileLockRegion implements ConcurrentRegion |
||
37 | { |
||
38 | const LOCK_EXTENSION = 'lock'; |
||
39 | |||
40 | /** |
||
41 | * var \Doctrine\ORM\Cache\Region |
||
42 | */ |
||
43 | private $region; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | private $directory; |
||
49 | |||
50 | /** |
||
51 | * var integer |
||
52 | */ |
||
53 | private $lockLifetime; |
||
54 | |||
55 | /** |
||
56 | * @param \Doctrine\ORM\Cache\Region $region |
||
57 | * @param string $directory |
||
58 | * @param string $lockLifetime |
||
59 | * |
||
60 | * @throws \InvalidArgumentException |
||
61 | */ |
||
62 | 12 | public function __construct(Region $region, $directory, $lockLifetime) |
|
76 | |||
77 | /** |
||
78 | * @param \Doctrine\ORM\Cache\CacheKey $key |
||
79 | * @param \Doctrine\ORM\Cache\Lock $lock |
||
80 | * |
||
81 | * @return boolean |
||
82 | */ |
||
83 | 10 | private function isLocked(CacheKey $key, Lock $lock = null) |
|
113 | |||
114 | /** |
||
115 | * @param \Doctrine\ORM\Cache\CacheKey $key |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 10 | private function getLockFileName(CacheKey $key) |
|
123 | |||
124 | /** |
||
125 | * @param string $filename |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | 6 | private function getLockContent($filename) |
|
133 | |||
134 | /** |
||
135 | * @param string $filename |
||
136 | * |
||
137 | * @return integer |
||
138 | */ |
||
139 | 6 | private function getLockTime($filename) |
|
143 | |||
144 | /** |
||
145 | * {@inheritdoc} |
||
146 | */ |
||
147 | 1 | public function getName() |
|
151 | |||
152 | /** |
||
153 | * {@inheritdoc} |
||
154 | */ |
||
155 | 10 | public function contains(CacheKey $key) |
|
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | 6 | public function get(CacheKey $key) |
|
175 | |||
176 | /** |
||
177 | * {@inheritdoc} |
||
178 | */ |
||
179 | public function getMultiple(CollectionCacheEntry $collection) |
||
187 | |||
188 | /** |
||
189 | * {@inheritdoc} |
||
190 | */ |
||
191 | 10 | public function put(CacheKey $key, CacheEntry $entry, Lock $lock = null) |
|
199 | |||
200 | /** |
||
201 | * {@inheritdoc} |
||
202 | */ |
||
203 | 3 | public function evict(CacheKey $key) |
|
211 | |||
212 | /** |
||
213 | * {@inheritdoc} |
||
214 | */ |
||
215 | 3 | public function evictAll() |
|
229 | |||
230 | /** |
||
231 | * {@inheritdoc} |
||
232 | */ |
||
233 | 6 | public function lock(CacheKey $key) |
|
249 | |||
250 | /** |
||
251 | * {@inheritdoc} |
||
252 | */ |
||
253 | 2 | public function unlock(CacheKey $key, Lock $lock) |
|
265 | } |
||
266 |
If you suppress an error, we recommend checking for the error condition explicitly: