Adds a pattern to the cache and returns the compiled pattern. This
method is in principle almost identical to
#getPattern(String) except for the fact that
it throws a MalformedPatternException if an expression cannot be
compiled.
addPattern() is meant to be used when you expressly intend to add
an expression to a cache and is useful for front-loading a cache
with expressions before use. If the expression added does not
already exist in the cache, it is compiled, added to the cache,
and returned. If the compiled expression is already in the cache, it
is simply returned.
The expected behavior of this method should be to start replacing
patterns in the cache only after the cache has been filled to capacity.