Block content cache 'max-age'

Created on 20 October 2022, over 2 years ago
Updated 12 September 2024, 5 months ago

Problem/Motivation

The cache only needs to be invalidated once the module settings are changed. It's hard to understand why cache max age is set to 0 by default.

Proposed resolution

The module works good with cache permanent.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

    Provided a patch for version 3

  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    Updated the patch to the latest in 3.0.x, and removed the list syntax change as it's unrelated.

  • Status changed to Closed: duplicate 12 months ago
  • πŸ‡¨πŸ‡¦Canada RobLoach Earth

    Technically that's a dupe of this one, check the creation dates :) .... Either way I'm happy to have more eyes on fixing caching.

  • Status changed to RTBC 12 months ago
  • πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

    @socialnicheguru Your logic is really interesting.
    ✨ Block content cache 'max-age' for Gtranslate 3.0+ Needs review Was created later but you called this one as a duplicate.
    It is not ethical to close someone else's task in favor of your own, even though this one was created earlier and already in the status of RTBC

    Reopened this ticket back to RTBC status and closed your one as a duplicate.

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    this one was for 8.1
    that one at the time was for 3.x
    That one is actually older for 3.x and that is why I did it.

  • πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

    @socialnicheguru

    1. It doesn't matter that the ticket was for 8.1 first. You were able to add your patch here for 3.x, instead of creating a new ticket (duplicate).
    2. At the moment this one contains a patch for 3.x too.
  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    My point was that I created the patch in the other issue for 3.x 9 months ago. 5 months ago you did the same thin in this issue.

    I did it there with a reference to this one because sometimes it is common practice to do patches for different versions in different issues.

    There was a clear link to this one which you decided not to follow.

    If you like to come in after someone else has done the work and take ownership, that is the way you do business.

    I like this module and just want to help.

  • Status changed to Needs review 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom AndyF

    Thanks everyone for the work so far, we also noticed our site caching being impacted.

    The cache only needs to be invalidated once the module settings are changed.

    Seems then that we ought to add a cache tag! See attached, thanks! (For 3.x)

  • First commit to issue fork.
  • Merge request !25Resolve #3316581 "Cache" β†’ (Open) created by leontin
  • Also added the "url" cache context.

    Paid versions that want to change the language prefix always have the cached version on each page.

  • Status changed to Fixed 6 months ago
  • πŸ‡¦πŸ‡²Armenia edo888

    @leontin thank you for your input, please check version 3.0.2

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡¬πŸ‡§United Kingdom AndyF

    I noticed that the actual change made also adds the url.query_args cache context. I could be going blind, but as far as I can tell the block build doesn't vary based on the URL or its query arguments (and it makes the caching less effective).

  • πŸ‡¬πŸ‡§United Kingdom AndyF

    Ah sorry, I am going blind (: I see where the URL is used, but not the query arguments...

            $orig_url = Html::escape(\Drupal::request()->getBasePath() . \Drupal::request()->getPathInfo());
            $orig_domain = Html::escape(\Drupal::request()->getHost());
    
Production build 0.71.5 2024