Optimized attachment caching