Sulu\Component\Cache\MemoizeInterface::memoize PHP Метод

memoize() публичный Метод

Returns the value stored in the cache or uses the passed function to compute the value and save to cache This function uses the callstack to generate a unique key for the caching mechanism.
public memoize ( callable $compute, integer $lifeTime = null ) : mixed
$compute callable
$lifeTime integer cache lifetime
Результат mixed
    public function memoize($compute, $lifeTime = null);

Usage Example

Пример #1
0
 /**
  * @return array
  */
 public function getTagsFunction()
 {
     return $this->memoizeCache->memoize(function () {
         $tags = $this->tagManager->findAll();
         $context = SerializationContext::create();
         $context->setSerializeNull(true);
         $context->setGroups(['partialTag']);
         return $this->serializer->serialize($tags, 'array', $context);
     });
 }
All Usage Examples Of Sulu\Component\Cache\MemoizeInterface::memoize
MemoizeInterface