Answers.Body: <p>You would wrap the code in your include in <code>cache</code> tags and use the keyword <a href="http://buildwithcraft.com/docs/templating/cache#globally" rel="nofollow"><code>globally</code></a> with it.</p>
  
  <pre><code>{% cache globally for 3 years %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-19T16:41:30.803Z
Answers.LastActivityDate: 2015-02-19T16:41:30.803Z
Answers.UserDisplayName: carlcs
Body: <p>I have an include that is doing a DB query (it generates a menu of entries) and that's used more than once on a template.</p>
  
  <p>Is there a way I can cache the first parse for later use to cut down on DB hits?</p>
  
Tags: <templating><database><performance>
Title: Can I cache an include for use elsewhere in a template?
ThreadText: # Can I cache an include for use elsewhere in a template?
  
  (Asked by: username_0 on 2015-02-19)
  
  I have an include that is doing a DB query (it generates a menu of entries) and that's used more than once on a template.
  
  Is there a way I can cache the first parse for later use to cut down on DB hits?
  
  **Tags:** templating, database, performance
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-19. Score: 2 | Accepted answer
  
  You would wrap the code in your include in `cache` tags and use the keyword [`globally`](http://buildwithcraft.com/docs/templating/cache#globally) with it.
  
  ```
  {% cache globally for 3 years %}
  
  ```
  
  
  ---
  
  