Added error handling in Caching library