# Question about query cache for 2.X

**URL:** <https://discuss.elastic.co/t/question-about-query-cache-for-2-x/56597>\
**Category:** Elasticsearch\
**Created:** [July 28, 2016, 9:43am UTC](https://discuss.elastic.co/t/question-about-query-cache-for-2-x/56597 "2016-07-28T09:43:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)\
**Post date:** [July 28, 2016, 9:43am UTC](https://discuss.elastic.co/t/question-about-query-cache-for-2-x/56597/1 "2016-07-28T09:43:38Z")

</div>

default value for  
"indices.queries.cache.count" is 1000 and  
"indices.queries.cache.size" is "10%"

my question is: if 1000 query won't occupy 10% memory, will it start to retire key or it won't until the memory is occupy 10%?

---

<div class="post-metadata">

**Author:** ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)\
**Post date:** [July 28, 2016, 9:49am UTC](https://discuss.elastic.co/t/question-about-query-cache-for-2-x/56597/2 "2016-07-28T09:49:37Z")

</div>

after read the code, it turns out that weather count or size beyond the max will cause evication of cache.  
boolean requiresEviction() {  
int size = this.mostRecentlyUsedQueries.size();  
return size == 0?false:size \> this.maxSize || this.ramBytesUsed() \> this.maxRamBytesUsed;  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:32pm UTC](https://discuss.elastic.co/t/question-about-query-cache-for-2-x/56597/3 "2017-07-05T22:32:12Z")

</div>


