Added repository for resources.
Privatized constructors + fixed stuff.
Simplified cache implementation (for HHVM and simpleness' sake)
Merge pull request #194 from xi-project/resource-repository

Resource repository