Better handle concurrency.

Rewrite caching to avoid repetitive retrievals or resizes under load.