Commit 517bb664 authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Implemented single cache lookup in AnnotationReader

parent 62e7146d
...@@ -106,10 +106,9 @@ class AnnotationReader ...@@ -106,10 +106,9 @@ class AnnotationReader
{ {
$cacheKey = $class->getName() . self::$CACHE_SALT; $cacheKey = $class->getName() . self::$CACHE_SALT;
//FIXME: Just use ->fetch(), otherwise some drivers, i.e. APC will fetch twice because they // Attempt to grab data from cache
// implement contains() in terms of fetch(), *sigh*. if (($data = $this->_cache->fetch($cacheKey)) !== false) {
if ($this->_cache->contains($cacheKey)) { return $data;
return $this->_cache->fetch($cacheKey);
} }
$annotations = $this->_parser->parse($class->getDocComment(), "class ".$class->getName()); $annotations = $this->_parser->parse($class->getDocComment(), "class ".$class->getName());
...@@ -143,10 +142,9 @@ class AnnotationReader ...@@ -143,10 +142,9 @@ class AnnotationReader
{ {
$cacheKey = $property->getDeclaringClass()->getName() . '$' . $property->getName() . self::$CACHE_SALT; $cacheKey = $property->getDeclaringClass()->getName() . '$' . $property->getName() . self::$CACHE_SALT;
//FIXME: Just use ->fetch(), otherwise some drivers, i.e. APC will fetch twice because they // Attempt to grab data from cache
// implement contains() in terms of fetch(), *sigh*. if (($data = $this->_cache->fetch($cacheKey)) !== false) {
if ($this->_cache->contains($cacheKey)) { return $data;
return $this->_cache->fetch($cacheKey);
} }
$context = "property ".$property->getDeclaringClass()->getName()."::\$".$property->getName(); $context = "property ".$property->getDeclaringClass()->getName()."::\$".$property->getName();
...@@ -181,10 +179,9 @@ class AnnotationReader ...@@ -181,10 +179,9 @@ class AnnotationReader
{ {
$cacheKey = $method->getDeclaringClass()->getName() . '#' . $method->getName() . self::$CACHE_SALT; $cacheKey = $method->getDeclaringClass()->getName() . '#' . $method->getName() . self::$CACHE_SALT;
//FIXME: Just use ->fetch(), otherwise some drivers, i.e. APC will fetch twice because they // Attempt to grab data from cache
// implement contains() in terms of fetch(), *sigh*. if (($data = $this->_cache->fetch($cacheKey)) !== false) {
if ($this->_cache->contains($cacheKey)) { return $data;
return $this->_cache->fetch($cacheKey);
} }
$context = "method ".$method->getDeclaringClass()->getName()."::".$method->getName()."()"; $context = "method ".$method->getDeclaringClass()->getName()."::".$method->getName()."()";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment