Add caching with user defined sizes