Enable gzip for SVGs, refactor caching function