Issue Bug Under Review Quiet

#82828stdWrap.cache doesn't use cached entries

Julian Hofmann 10/20/17, 11:09 updated 10/01/26, 06:55

Description

Tried to use stdWrap.cache on different instances (TYPO3 7.6.23 and 8.7.8) according to https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/Cache/ But the content is rendered for each page instead of sharing it with other pages.

Also the exact example doesn’t work:

page = PAGE
page.5 = TEXT
page.5 {
  stdWrap.cache.key = mycurrenttimestamp
  stdWrap.cache.tags = tag_a,tag_b,tag_c
  stdWrap.cache.lifetime = 3600
  stdWrap.data = date : U
  stdWrap.strftime = %H:%M:%S
}

Reviews 1

History 1011

  1. Susanne Moog commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2017-10-20T11:56:57+00:00" > 10/20/17, 11:56 </span>

    Can you check if the following works for you:

    page.10 = TEXT
    page.10 {
      cache.key = mycurrenttimestamp
      cache.tags = tag_a,tag_b,tag_c
      cache.lifetime = 3600
      data = date : U
      strftime = %H:%M:%S
    }

    I think there is a documentation change missing since https://review.typo3.org/#/c/35915/15 was merged.

  2. Julian Hofmann commented <span data-processor="relativetime" data-value="2017-10-20T16:59:10+00:00" > 10/20/17, 16:59 </span>

    Thank you, your snippet works and I could solve my usecase.

    But I think, it is not only a missing documentation change.
    “cache” is currently documentated under “Function” (with wrong example), but also as Property of stdWrap (with link to cache function). So, the stdWrap.cache example should work, too. Or is there no cache-property in stdWrap anymore? But stdWrap.cache is writing to the cache (or at least stores the cache-identifiers) but doesn’t get data from the cache.

  3. Susanne Moog commented <span data-processor="relativetime" data-value="2017-11-04T14:18:20+00:00" > 11/04/17, 14:18 </span>

    It does get data from the cache but due to the execution order of the stdWrap properties the data gotten from the cache gets overwritten by the subsequent stdWrap calls. If I understand the history correctly before the change the “cache get” stopped the execution of the subsequent calls while now the result from “cache get” gets set as value and is then used in further potential processing. I’m not sure which way is more / less correct or what the intended behaviour was. I’ll try to figure it out.

  4. Stefan Neufeind commented and changed category status Needs Feedback Accepted <span data-processor="relativetime" data-value="2017-11-06T11:53:47+00:00" > 11/06/17, 11:53 </span>

    So this makes it a documentation-issue then. Thanks – updated.

  5. Julian Hofmann commented <span data-processor="relativetime" data-value="2017-11-06T12:07:43+00:00" > 11/06/17, 12:07 </span>

    No, it is not just a documentation thing.

    The breaking.rst says “``stdWrap.cache`` continues to exist and can be used as before.” – this is not true. It is not working like before.
    The break is discribed for cases where “you’ve previously used the ``cache.`` property in your custom cObject”, not for normal (non-custom) cObjects.

  6. Garvin Hicking commented and changed status Accepted Needs Feedback <span data-processor="relativetime" data-value="2024-06-11T13:29:56+00:00" > 06/11/24, 13:29 </span>

    Hi Julian,

    I would somehow like to wrap (haha) this up but am having a bit of difficulty seeing how to properly adjust this and were.

    Do you maybe have a suggestion on what to (retro-actively) change in the breaking.rst as well in the docs of https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Cache.html#cache-1? The text there is unchanged compared to 7.6 so I do think we could improve this there?

    Regards,
    Garvin

  7. Julian Hofmann commented <span data-processor="relativetime" data-value="2024-06-11T13:45:21+00:00" > 06/11/24, 13:45 </span>

    Whew. A lot of time has passed…

    If I read this correctly, then stdWrap.cache has simply stopped working since the change. At least no longer for reading cache contents (or is overwritten again).

    It would therefore be worth considering whether stdWrap.cache is still of any use at all.
    Alternatively, it should be documented that it can only be used to fill the cache (whereby the question arises as to how/where it can then be read out again)

  8. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-06-14T22:20:58+00:00" > 06/14/24, 22:20 </span>

    I’ve asked lolli since I sadly can’t answer if/how/where stdWrap.cache is utilized or useful, so sadly can’t really contribute here and hope it gets picked up by someone who uses stdWrap.cache :)

    (Leaving this open for a while)

  9. Lina Wolf commented and changed category TYPO3 Version 8 15 <span data-processor="relativetime" data-value="2026-10-01T06:49:28+00:00" > 10/01/26, 06:49 </span>

    Confirmed on main: The value is written to cache but stdWrap is still reaplied, this can cause unexpected behaviour when combining it with other stdwrap functions.

    Added a WIP patch with a failing functional test

  10. Gerrit Code Review pushed patch set 1 for main to change 96249 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2026-10-01T06:55:03+00:00" > 10/01/26, 06:55 </span>