Exemplo n.º 1
0
 public function invoke($object, $method = '__invoke', $args = [], CacheProfile $cacheProfile = null)
 {
     if (null === $cacheProfile) {
         return $this->doInvoke($object, $method, $args);
     }
     return $cacheProfile->execute(function () use($object, $method, $args) {
         return $this->doInvoke($object, $method, $args);
     });
 }
Exemplo n.º 2
0
 public function findFromSource(Source $sourceMetadata, array $resolvedArgs)
 {
     if ($sourceMetadata->getMethod()->isNull()) {
         return null;
     }
     $class = $sourceMetadata->getMethod()->getClass();
     $source = $this->classResolver ? $this->classResolver->resolve($class) : new $class();
     //$cacheKey = $sourceMetadata->getId() . $class . $sourceMetadata->getMethod()->getFunction();
     $cacheKey = $this->getCacheKey($sourceMetadata, $resolvedArgs);
     return $this->methodInvoker->invoke($source, $sourceMetadata->getMethod()->getFunction(), $resolvedArgs, $this->cacheProfile ? $this->cacheProfile->setKey($cacheKey)->derive() : null);
 }