Refactored Caching to Model

Moved all the caching from the service controller to the reference
model. The caching is shared in the model across multiple controllers
this way. The caching strategy basically is before making a query check
if the cache exists in memcached