Added a caching function to the login model.