Skip to content

Loading…

Invalidation of class annotations cache #54

Closed
wants to merge 1 commit into from

2 participants

@schmittjoh
Doctrine member

Please add a test.

@fprochazka

I don't have time now. I hope it can wait till tomorrow.

@schmittjoh
Doctrine member

Since we are only reading the annotations of one file, I don't see why we need this.

@schmittjoh schmittjoh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 21, 2011
  1. @fprochazka
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/Doctrine/Common/Annotations/CachedReader.php
View
12 lib/Doctrine/Common/Annotations/CachedReader.php
@@ -170,10 +170,14 @@ public function clearLoadedAnnotations()
private function isCacheFresh($cacheKey, \ReflectionClass $class)
{
- if (false === $filename = $class->getFilename()) {
- return true;
- }
+ $time = $this->cache->fetch('[C]'.$cacheKey);
+ do {
+ if ($filename = $class->getFilename() && $time < @filemtime($filename)) { // stat may fail
+ return false;
+ }
+
+ } while ($class = $class->getParentClass());
- return $this->cache->fetch('[C]'.$cacheKey) >= filemtime($filename);
+ return true;
}
}
Something went wrong with that request. Please try again.