Use an inline cache when accessing Application.injector

Improves application performance by about 3–5% in some benchmarks by eliminating calls to Guice when making requests.

@jroper, you might be interested in this one.
Yes, what you've written is the recommended way to do things in Play 2.4. In your example there won't be any Guice overhead to look up the CacheApi once the application is loaded.

At the moment we do have some places where Guice is still being called on every request, even in DI applications. We still need to finish porting all the APIs (e.g. body parsers). I think our goal should be to only call Guice when the application loads. Does that sound OK to you?

This PR is going to help users who are using the old singleton APIs. The plan is to eventually deprecate/remove all non-DI APIs and only support DI. But, like you say, there are some choices how to manage the migration.

Personally I think we should make sure that Play 2.4 still works well for non-DI apps. Upgrading to DI will be complex for many users so we want to give them time to do it. I don't think we want their build to have too many warnings when they upgrade, nor do we want their app to slow down. Since changing to DI will affect almost every API in Play I'd suggest that at least a minor version is needed so that users can upgrade. So maybe we could leave most of the APIs un-deprecated in Play 2.4 and then do full deprecation in Play 2.5. What do you think?

BTW, this is all just my opinion, I don't think we have an "official" plan for migration just yet. :)

As for complexity, I will admit that this PR does increase complexity. :) But hopefully the complexity is mostly isolated to a single class (InlineCache) and the code is still reasonably simple elsewhere.