# Question about named query cache management

**URL:** <https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967>\
**Category:** Ignition\
**Created:** [October 3, 2018, 7:40pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967 "2018-10-03T19:40:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 3, 2018, 7:40pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/1 "2018-10-03T19:40:08Z")

</div>

Hi @KathyApplebaum  
In case of a select named query with parameters, I suppose that the cache doesn’t take care of the value of the query parameter ?  
Example : named query “select”, param1  
if we execute the query with param1 = A and the with param1= B, the named query reset the cached result or keep a cached result for the query with param 1 = A and another cached result for the query with param 2 = B ???

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 3, 2018, 7:48pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/2 "2018-10-03T19:48:10Z")

</div>

The ‘cache key’ that is used for caching is derived from the resource ID, the arguments, the string body of the query itself, and the database that it executes against.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 3, 2018, 7:51pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/3 "2018-10-03T19:51:57Z")

</div>

For the arguments, you mean the query parameters, or the query parameters AND the value of these parameters ?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 3, 2018, 7:57pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/4 "2018-10-03T19:57:54Z")

</div>

The values of the arguments.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 3, 2018, 8:00pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/5 "2018-10-03T20:00:59Z")

</div>

So in your example that query will be cached twice – once for param1 = A and once for param1= B

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 3, 2018, 8:19pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/6 "2018-10-03T20:19:17Z")

</div>

Thanks for these clarifications, I’ve just seen the doc is quite detailed about named query behaviour…😊  
In the doc, I suppose that “Once the lifespan expires, the cache is invalidated” means that for the case of a named query cached twice: with param1 = A and param 1 = B, both cached result are invalidated ?

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 3, 2018, 8:29pm UTC](https://forum.inductiveautomation.com/t/question-about-named-query-cache-management/19967/7 "2018-10-03T20:29:03Z")

</div>

Each result is invalidated separately. They are treated as totally different things.
