Added in-memory caching from string templates to avoid repeated parsing.