Caching library with support for multiple cache backends