Skip to content

Commit

Permalink
Added caching of system node information
Browse files Browse the repository at this point in the history
Applied optimization found in 2.8 for caching of system node information
  • Loading branch information
zerrvox authored and ramsey committed Jun 16, 2015
1 parent a9d4f93 commit 7fe4350
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Provider/Node/SystemNodeProvider.php
Expand Up @@ -8,7 +8,12 @@ class SystemNodeProvider implements NodeProviderInterface
{
public function getNode()
{
$node = null;
static $node = null;

if($node !== null) {
return $node;

This comment has been minimized.

Copy link
@jmauerhan

jmauerhan Mar 24, 2016

Contributor

I don't think this line is reachable. Am I wrong?

This comment has been minimized.

Copy link
@fabre-thibaud

fabre-thibaud Mar 24, 2016

It's declared as static, so it should be reachable considering there's an assignment couple of lines down. There is however one code path that will never reach it, if SystemNodeProvider::getIfConfig()'s return value does not match $pattern. That's a bit annoying as that triggers an exec call on every UUID that you will generate in this configuration and has a very negative impact on performance.

This comment has been minimized.

Copy link
@jmauerhan

jmauerhan Mar 24, 2016

Contributor

Ah, I see how it works - Thanks - I can write the test for that now! :)

}

$pattern = '/[^:]([0-9A-Fa-f]{2}([:-])[0-9A-Fa-f]{2}(\2[0-9A-Fa-f]{2}){4})[^:]/';
$matches = array();

Expand Down

0 comments on commit 7fe4350

Please sign in to comment.