Adding configurable upper bound for input cache. Renaming master cache.

In the past the input cache was an unbounded list that could outgrow
the processes memory. This commit introduces an (optional) config
option named "input_cache_max_size" that defines the maximum size of
the input cache. When it's reached, further messages will be dropped
unless the input cache size shrinks.

All class/instance names referring to "master cache" instead of "input
cache" have been renamed.