ttempleton / craft-nocache

Craft CMS Twig extension to escape caching inside cache blocks
MIT License
46 stars 6 forks source link

Things Inside of nocache becomes cached. #17

Closed wedot closed 5 years ago

wedot commented 5 years ago

Description

I have the problem that things inside the nocache tag becomes cached. It's a onepager, every section is a entry and inside of that i have a neo field.

Additional information

The Code

{% cache globally using key "home-" ~ craft.app.request.pathInfo %}
{%- minify -%}

    {% for entry in entry.siteSection.all() %}
        <section id="{{ entry.navTitle | kebab }}">

            {% if entry.bodyMain is defined and entry.bodyMain | length %}
                {% for block in entry.bodyMain.all() %}
                    {% switch block.type.handle %}

                        {% case 'callTeam' %}   

                            {% nocache %}
                                {% set team = craft.entries.section('team').order('RAND()').all() %}

                                {% for entry in team %}
                                    {% switch entry.type %}
                                        {% case 'team' %}
                                            Code

                                        {% case 'job' %}
                                            Code

                                        {% case 'default' %}

                                    {% endswitch %}
                                {% endfor %}
                            {% endnocache %}

                    {% endswitch %}
                {% endfor %}
            {% endif %}

        </section>
    {% endfor %}

{%- endminify -%}
{% endcache %}
ttempleton commented 5 years ago

Hi @wedot,

I'm having trouble reproducing this, sorry... To clarify, is the issue that the order of

craft.entries.section('team').order('RAND()').all()

is always the same? If so, does it work properly if you remove the cache and nocache tags?

wedot commented 5 years ago

I have found the problem. It don't was your plugin rather then the file caching from my hoster. I don't know that the hoster uses a file caching over the cms caching...

Verything is fine now. thank you for your support :)

ttempleton commented 5 years ago

No worries @wedot; good to hear that it's all fine now!