Implement experimental caching
Generalize caching via parse_template