Switch to DeviceDetector 2.X #305
…or. This cache combines file and static caching to speed up detections as much as possible
By caching parsed DeviceDetectors, we reduce the number of regexes to process. It allows to process more requests per second when the same user agent is met.
The previous commit had at least 2 issues : one identified by sgiehl, who reported that the static variable was useless if we always create a new cache instance, and indeed, he's absolutely right ! Another one can be classified as a potential security issue, where a request can forge a user agent as a key to an object which is not meant to be accessed (CacheStatic instances share their data).
…detector based on the given user agent. That provides the possibility to reuse DeviceDetector for bot and visitor data detection.
@sgiehl Tests are in progress. From the first results, It seems it's a little better but I can't import more than 800-810req/s (which is still quite good compared to the results without any cache). I'm making some more tests but I think it's because with the factory, we're calling the parse() method for everything and not only for bots.
DeviceDetector skips parsing additional data when a bot is detected. So it