Added closure for templte cache