lookup queries by hash, rather than by query string

This allows a couple of improvements:
* speed up access to the query cache - hash lookups for short fixed-length
  hashes will be a lot quicker than for 100k strings
* we can store extra metadata with each monitor query, allowing us to, for
  example, pick different query parsers at parse time.
Merge branch '1.1.x' into topic/query-metadata
Allow the Monitor to purge unused queries

This is done by running a query against the monitor's queryindex and collecting
all queries referenced, and then swapping this collection out for the previous
cache.

To be threadsafe, updates to the queryindex are now done while holding the
readlock of a ReadWriteLock, and the cache holds the writelock firstly during
the creation of an update log, and then when the update log is copied to the
new cache and the caches are swapped.
Replace external QueryCache with MonitorQueryParser

...and we circle around again.  Details of how the cache works are now important
for purging, so it should become internal to the Monitor.  All that is
configurable is the query parser, so abstract that out and pass it in to the
Monitor as a constructor parameter.
Run purgeCache in scheduled background thread