Use standard, generic memoize function to create image cache.