# Caching behavior

**URL:** <https://community.apollographql.com/t/caching-behavior/7892>\
**Category:** Client SDKs\
**Tags:** client\
**Created:** [October 11, 2024, 8:24pm UTC](https://community.apollographql.com/t/caching-behavior/7892 "2024-10-11T20:24:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikita\_Bortnikov](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/nikita_bortnikov/32/5331_2.png) [@Nikita\_Bortnikov](https://community.apollographql.com/u/Nikita_Bortnikov)\
**Post date:** [October 11, 2024, 8:24pm UTC](https://community.apollographql.com/t/caching-behavior/7892/1 "2024-10-11T20:24:05Z")

</div>

Hello everyone, could you please help me with the following:  
I have this query

```auto
query Samples(
    $condition: SampleCondition
    $filter: SampleFilter
    $geneFamilyIds: [Int!] = []
    $geneIds: [Int!] = []
  ) {
    sampleStats(condition: $condition, filter: $filter) {
      id
      cardGeneFamilies(geneFamilyIds: $geneFamilyIds) {
        key
        value
      }
      cardGenes(geneIds: $geneIds) {
        key
        value
      }
    }
  }

```

i make a request, with an array of geneIds filled with [1,2]. Receive a response and cache the data into MemoryCache. Then I make a request again with an array of geneIds [3,4], and of course I see a new request, because the variables changed.  
After that, I make a request with geneIds as [1,2] again, and I expect cache to work, to get data from the cache. But instead I see a request to my API.  
How can I fix it ? As you can see ‘SampleStats’ type, which is returned by sampleStats, actually has an id field, so I expect it to be cached.

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [October 14, 2024, 4:23pm UTC](https://community.apollographql.com/t/caching-behavior/7892/2 "2024-10-14T16:23:32Z")

</div>

Hi @Nikita_Bortnikov. Which client are you using - Web (TypeScript), iOS, or Kotlin?

---

<div class="post-metadata">

**Author:** ![Nikita\_Bortnikov](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/nikita_bortnikov/32/5331_2.png) [@Nikita\_Bortnikov](https://community.apollographql.com/u/Nikita_Bortnikov)\
**Post date:** [October 14, 2024, 4:57pm UTC](https://community.apollographql.com/t/caching-behavior/7892/3 "2024-10-14T16:57:25Z")

</div>

hello, I use Web client.  
I investigated around, and now I realize, that the problem somehow related to the fact that, I have parent field arguments, and children field arguments in the query. So whenever child arguments change, I refetch the entire field including parent, and then even when I try to fetch child with the previous old argument, the cache doesn’t give me the data. I somehow need to configure the Apollo in a way that, child field is refetched if **parent OR child arguments changed**. In all other cases I need to get data from the cache
