Next: , Previous: noweb-sep, Up: Specific header arguments :cache

The :cache header argument controls the use of in-buffer caching of the results of evaluating code blocks. It can be used to avoid re-evaluating unchanged code blocks. Note that the :cache header argument will not attempt to cache results when the :session header argument is used, because the results of the code block execution may be stored in the session outside of the Org mode buffer. The :cache header argument can have one of two values: yes or no.

Code block caches notice if the value of a variable argument to the code block has changed. If this is the case, the cache is invalidated and the code block is re-run. In the following example, caller will not be re-run unless the results of random have changed since it was last run.

      #+NAME: random
      #+BEGIN_SRC R :cache yes
      #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
      #+NAME: caller
      #+BEGIN_SRC emacs-lisp :var x=random :cache yes
      #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller