Package ua_parser
Class CachingParser
- java.lang.Object
-
- ua_parser.Parser
-
- ua_parser.CachingParser
-
public class CachingParser extends Parser
When doing webanalytics (with for example PIG) the main pattern is to process weblogs in clickstreams. A basic fact about common clickstreams is that in general the same browser will do multiple requests in sequence. This has the effect that the same useragent will appear in the logfiles and we will see the need to parse the same useragent over and over again. This class introduces a very simple LRU cache to reduce the number of times the parsing is actually done.- Author:
- Niels Basjes
-
-
Constructor Summary
Constructors Constructor Description CachingParser()
CachingParser(InputStream regexYaml)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Client
parse(String agentString)
Device
parseDevice(String agentString)
OS
parseOS(String agentString)
UserAgent
parseUserAgent(String agentString)
-
-
-
Constructor Detail
-
CachingParser
public CachingParser() throws IOException
- Throws:
IOException
-
CachingParser
public CachingParser(InputStream regexYaml)
-
-
Method Detail
-
parseUserAgent
public UserAgent parseUserAgent(String agentString)
- Overrides:
parseUserAgent
in classParser
-
parseDevice
public Device parseDevice(String agentString)
- Overrides:
parseDevice
in classParser
-
-