croxton/Stash — pull request #125 by rsanchez (2014-11-27 12:42:07+00:00)
Title: Add escape_stash parameter for CE Cache

Hi Mark,

This pull request aims to improve compatibility with CE Cache by providing a way to "escape" Stash tags within CE Cache tags. The main purpose is to be able to avoid the scenario where CE Cache stores the output of an exp:stash:set tag, whose "output" is technically nothing.

The original idea comes from the creator of CE Cache himself, in this support thread: http://devot-ee.com/add-ons/support/ce-cache/viewthread/7568

To illustrate why this is useful:

```
{exp:ce_cache:it}
{exp:stash:set_list parse_tags="yes" name="entries"}
{exp:channel:entries channel="blog"}
{stash:title}{title}{/stash:title}
{stash:url_title}{url_title}{/stash:url_title}
{/exp:channel:entries}
{/exp:stash:set_list}
{/exp:ce_cache:it}

{exp:stash:get_list name="entries"}

{title}

{/exp:stash:get_list}

```

Here, CE Cache will literally store an empty string as the cached output. On subsequent visits to this page, you'll see nothing because exp:stash:set_list doesn't get called at runtime.

With this pull, I can now do this:

```
{exp:ce_cache:it escape_stash="yes"}
{exp:stash:set_list parse_tags="yes" name="entries"}
{exp:channel:entries channel="blog"}
{stash:title}{title}{/stash:title}
{stash:url_title}{url_title}{/stash:url_title}
{/exp:channel:entries}
{/exp:stash:set_list}
{/exp:ce_cache:it}

{exp:stash:get_list name="entries" process="end"}

{title}

{/exp:stash:get_list}

```

CE Cache will store something like this:

```
{exp:stash:set_list parse_tags="yes" name="entries"}

{stash:title}Another blog post{/stash:title}
{stash:url_title}another-blog-post{/stash:url_title}

{stash:title}Second Post{/stash:title}
{stash:url_title}second-post{/stash:url_title}

{stash:title}Post{/stash:title}
{stash:url_title}post{/stash:url_title}

{/exp:stash:set_list}
```

Which will then get executed at runtime.