We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42822
    • 21 Posts
    Hi,

    Is there a way to disable caching for a context (for Elements and Resources)?

    i found an context option to set, but it seems it doesn't fit my requirements:
     cache_disabled


    Edit: I use Revo 2.2.6

    This question has been answered by hamada. See the first response.

      • 37044
      • 68 Posts
      Can you possibly provide a little more information about your requirements. Turning off caching across a whole context sounds a bit in-efficient.

      I don't want to state the obvious but I assume you know you can turn off caching on specific snippet calls typically with an "!" Including wayfinder / getResources etc?

      http://rtfm.modx.com/display/revolution20/Tag+Syntax

      [[!yourSnippet]] (will call uncached)
      [[yourSnippet]] (will call cached)
        • 42822
        • 21 Posts
        Your right, but i want to disable cache because i got some wierd behaviour on the page:

        i got a context containig admin dashboard.

        to build a navigation displaying elements count for each page, (elements are stored in an custom DB) i update a TV (alias *count) for every page through a Snippet (alias setCount) calling a Snippet (alias CountElements) that counts xPDOObjects (::getCollection) on every page. These TV data is used to build the navigation. I do so, because the DB can only be manipulated within the specific page.

        [[!setCount? &id=`resId` &value=`[[!CountElements? &parent=`parentId`]]`]]


        instead of the actual TV value a cached one is displayed. sad
        why?
        • discuss.answer
          • 42822
          • 21 Posts
          finally, after a long frustration i found the mistake sad
          i called wayfinder uncached! what i normally never do (thats why i never suspected it there)

          exclamation mark : Small but packs a punch !!!!!!!
            • 37044
            • 68 Posts
            Classic mistake which unfortunately I still make to this day!! Second only to changing anything on my site and wondering why its not showing up then remembering Modx 101 clear the cache (then clear it again!)...

            Glad you got it working.