mw.Title already exists though it needs more work and could use some caching.
mw.User doesn't exist yet as a constructor, but preliminary work has already been done with a lazy-loading system (with the introduction of mw.user.getGroups and mw.user.getRights - similar to in PHP where those methods call ->init() which does nothing if already loaded and loads it if not).
Each of these would be constructed (without being initialized) by default in their lowercase equivalents (mw.title, mw.user, mw.page).
I suggest we write an abstract class that implements:
- Caching by unique identifier
- Methods to clear cache
- Methods to populate cache
Eventually this will also allows us to clean up stuff that doesn't belong in mw.config (wgUserName, wgUserGroups, wgCategories, wgCurRevisionId, wgTitle).
And if those vars provide sufficient information to fully populate a cache, we can even optimize for the current context instances and prepopulate them.
Or do it the other way around (populate mw.user/title/page/revision from the page output, and put a backwards compatible thing in mw.config that accesses those from mw.user/title/page/revision)