0

Is there any difference in processing/speed in using Stash exp:stash:set with output=yes vs. using Stash to set and then outputting via exp:stash:get? For example:

OPTION 1:
{exp:stash:set name="client_age" 
    save="yes"
    output="yes"
    refresh="no"
    trim="yes" 
    parse_tags="yes"
    parse_conditionals="yes" 
    parse_depth="2"
    scope="user"
}
    {exp:channel:entries channel=".....}
        {PLUGIN}{content}{/PLUGIN}
    {/exp:channel:entries}
{/exp:stash:set}

VERSUS OPTION 2:
{exp:stash:set name="client_age" 
    save="yes"
    refresh="no"
    trim="yes" 
    parse_tags="yes"
    parse_conditionals="yes" 
    parse_depth="2"
    scope="user"
}
    {exp:channel:entries channel=".....}
        {PLUGIN}{content}{/PLUGIN}
    {/exp:channel:entries}
{/exp:stash:set}

{exp:stash:get name="client_age" scope="user"}
2
  • I think it's a good question for pure curiosity, but why would you use option 1 with Stash if you're not needing to 'get' it later? May 21 '13 at 16:25
  • Option 1 is being saved to the database as well as 2, so I don't want to run the inner content for the duration it's saved. I'm hoping to see if they're efficiently the same, and both pull from the stash table once the variable has been written. May 21 '13 at 17:03
1

Option 1 will be a tiny bit quicker, since EE only needs to process one tag. It's a good approach for caching arbitrary chunks of template code.

Unless you really do need to have a personalised cached item for every visitor to your site I would suggest you use scope="site".

1
  • Thanks Mark! This was for a variable only shown to the individual logged in user (age I think). May 22 '13 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.