add setCache function to set the cache handler, if it’s not set in the constructor