How to use `{% cache %}` and `{% paginate %}` together? When using cache tag with pagination should the tag go outside the pagination tag?

{% cache %}
&lt;div class="grid-x grid-padding-x" data-equalizer data-equalize-on="medium"&gt;
    {% paginate craft.entries.section('employment').endDate('&gt;= ' ~ now).limit(10) as pageInfo, pageEntries %}
    {% for entry in pageEntries %}
        &lt;div class="small-12 medium-6 large-6 cell"&gt;
            &lt;div class="news-card" data-equalizer-watch&gt;
                &lt;div class="card-section text-center"&gt;
                    &lt;h5&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h5&gt;
                    &lt;p&gt;
                    &lt;span class="label my-purple"&gt;
                        {% if entry.openUntilFilled %}
                            Open Until Filled
                        {% else %}
                            Job Closing: {{ entry.endDate.format('M j, Y') }}
                        {% endif %}
                    &lt;/span&gt;
                    &lt;/p&gt;
                    &lt;p&gt;{{ entry.body|length &gt; 1 ? entry.body|striptags|slice(0, 150) ~ '...' : entry.body }}&lt;/p&gt;
                    &lt;p&gt;&lt;a class="more" href="{{ entry.url }}"&gt;Read More&lt;/a&gt;&lt;/p&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    {% endfor %}
&lt;/div&gt;
&lt;div class="grid-x grid-padding-x"&gt;
    &lt;div class="small-12 cell"&gt;
        {% if pageInfo.prevUrl %}&lt;a href="{{ pageInfo.prevUrl }}"&gt;Previous Page&lt;/a&gt;&amp;nbsp;{% endif %}
        {% if pageInfo.nextUrl %}&lt;a href="{{ pageInfo.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}
    &lt;/div&gt;
&lt;/div&gt;
{% endcache %}
Yes, the database query you'd want to cache is this:

{% paginate craft.entries.section('employment').endDate('&gt;= ' ~ now).limit(10) as pageInfo, pageEntries %}


So to get the benefits of caching, it needs to be within the cache tag.