Jarves\StopwatchHelper::stop PHP Method

stop() public method

public stop ( string $name )
$name string
    public function stop($name)
    {
        if ($this->stopwatch) {
            $this->stopwatch->stop($name);
        }
    }

Usage Example

Example #1
0
 /**
  * Returns a distributed cache value.
  *
  * This uses cache invalidation mechanism described in
  *
  * @see setDistributedCache() for more information invalidateCache().
  *
  * @param string $key
  *
  * @return mixed null when not found
  */
 public function getDistributedCache($key)
 {
     $this->stopwatch->start(sprintf('Get Cache `%s`', $key));
     $cache = $this->fastCache->get($key);
     if (null === $cache) {
         $this->stopwatch->stop(sprintf('Get Cache `%s`', $key));
         return null;
     }
     if (!is_array($cache) || !isset($cache['timestamp'])) {
         throw new \RuntimeException(sprintf('You requested a cache through the distributed cache mechanism, which was not ' . 'set through this mechanism. You can only distributed cache when you set the cache through the' . 'distributed cache. [%s]', substr($cache, 0, 50)));
     }
     $isValid = $this->isCacheIsValid($key, $cache['timestamp']);
     $this->stopwatch->stop(sprintf('Get Cache `%s`', $key));
     return $isValid ? $cache['data'] : null;
 }
All Usage Examples Of Jarves\StopwatchHelper::stop