-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple UA analyzer and parser to allow caching #109
Conversation
->booleanNode('enabled') | ||
->defaultFalse() | ||
->end() | ||
->scalarNode('service') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be parser instead of service
Don't forget to update README |
7ee18f2
to
9acd532
Compare
|
||
$name = $this->parser->getUaFamily($userAgent); | ||
|
||
if (null !== $item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will store the result only when there was an exception, but not when there was no hit.
00ff590
to
2ff8c36
Compare
2ff8c36
to
57e586b
Compare
Just pushed a final version with README updated. Comments are welcome |
private $lifetime; | ||
private $prefix; | ||
|
||
public function __construct(CacheItemPoolInterface $cache, UAFamilyParser $parser, $lifetime = 0, $prefix = 'nelmio-ua-parser-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not type-hint the interface instead?
While using this browser_adaptive feature, I realized it consumes quite a lot of CPU.
This PR decouple analyzer and parser so that cache can be used