smart caching for static resources