CodeExplorer fetchFromCache example
/**
* {@inheritDoc}
*/
public function getClassAnnotations(ReflectionClass
$class) { $cacheKey =
$class->
getName();
if (isset($this->loadedAnnotations
[$cacheKey])) { return $this->loadedAnnotations
[$cacheKey];
} $annots =
$this->
fetchFromCache($cacheKey,
$class, 'getClassAnnotations',
$class);
return $this->loadedAnnotations
[$cacheKey] =
$annots;
} /**
* {@inheritDoc}
*/
public function getClassAnnotation(ReflectionClass
$class,
$annotationName) { foreach ($this->
getClassAnnotations($class) as $annot) { if ($annot instanceof
$annotationName) { /**
* {@inheritDoc}
*/
public function getClassAnnotations(ReflectionClass
$class) { $cacheKey =
$class->
getName();
if (isset($this->loadedAnnotations
[$cacheKey])) { return $this->loadedAnnotations
[$cacheKey];
} $annots =
$this->
fetchFromCache($cacheKey,
$class);
if ($annots === false
) { $annots =
$this->delegate->
getClassAnnotations($class);
$this->
saveToCache($cacheKey,
$annots);
} return $this->loadedAnnotations
[$cacheKey] =
$annots;
} /**
* {@inheritDoc}
*/