# Update Template On Set Schedule, Cache Results

**URL:** https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427
**Category:** General
**Created:** [20 July 2020 23:02 UTC](https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427 "2020-07-20T23:02:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Majerus1223](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@Majerus1223](https://discourse.nodered.org/u/Majerus1223)
#### Post date: [20 July 2020 23:02 UTC](https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427/1 "2020-07-20T23:02:11Z")

</div>

Is there a way to have a template updated once, then for calls following the initial load just return the same data?

I am attempting to have a schedule kick off at 12am, gather data then update the said template. When other calls to the http end point are called, I would like to just have that cache data returned. Super new to node red, sorry if this question is super basic.

Thanks!

Example

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcd97697f0aabdf04de8f153d05a59bf006567b9.png)

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [20 July 2020 23:09 UTC](https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427/2 "2020-07-20T23:09:46Z")

</div>

Hi @Majerus1223

Good question. The Template node itself cannot cache results, but you can use Context in order to do this.

This recipe in the cookbook shows the basic principle - [https://cookbook.nodered.org/http/include-data-from-another-flow](https://cookbook.nodered.org/http/include-data-from-another-flow)

You can store the data returned by the Widget Data node in Context using a Change node.

You can then either update the Template node to retrieve values from Context (check its sidebar help for how to do that), or you could add a Change node ahead of it to get the data from Context and copy it back onto the message where the Template node expects it to be.

---

<div class="post-metadata">

### Author: ![Majerus1223](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@Majerus1223](https://discourse.nodered.org/u/Majerus1223)
#### Post date: [20 July 2020 23:12 UTC](https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427/3 "2020-07-20T23:12:15Z")

</div>

Thanks for the fast response, ill give this a shot.

---

<div class="post-metadata">

### Author: ![Majerus1223](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@Majerus1223](https://discourse.nodered.org/u/Majerus1223)
#### Post date: [20 July 2020 23:28 UTC](https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427/4 "2020-07-20T23:28:10Z")

</div>

This solution worked perfectly! Thanks!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [3 August 2020 23:28 UTC](https://discourse.nodered.org/t/update-template-on-set-schedule-cache-results/30427/5 "2020-08-03T23:28:11Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
