Skip to content

Commit 38d3365

Browse files
author
Alexander Obuhovich
committed
Introduce cache versioning
1 parent c9072aa commit 38d3365

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/annotations/AnnotationManager.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class AnnotationManager
2020
{
21+
const CACHE_FORMAT_VERSION = 3;
22+
2123
const MEMBER_CLASS = 'class';
2224

2325
const MEMBER_PROPERTY = 'property';
@@ -193,7 +195,8 @@ protected function getAnnotationFile($path)
193195
$code = $this->getParser()->parseFile($path);
194196
$data = eval($code);
195197
} else {
196-
$key = basename($path) . '-' . sprintf('%x', crc32($path . $this->_cacheSeed));
198+
$checksum = crc32($path . ':' . $this->_cacheSeed . ':' . self::CACHE_FORMAT_VERSION);
199+
$key = basename($path) . '-' . sprintf('%x', $checksum);
197200

198201
if (($this->cache->exists($key) === false) || (filemtime($path) > $this->cache->getTimestamp($key))) {
199202
$code = $this->getParser()->parseFile($path);

0 commit comments

Comments
 (0)