Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78466

A static cache value returning an empty array will be fetched from the real cache

XMLWordPrintable

    • 1
    • Team Hedgehog 2023 Sprint 2.2

      If a statically accelerated cache returns an empty array then the value is still fetched from the non-static cache store.

      This happens because the result check is not strict enough.

      Specifcally, MDL-72837 introduced a change from:

      if ($result === false) {
      

      To:

      if (!$result) {
      

      In the case of values such as:

      • 0
      • null
      • []
      • ''

      This will lead to both the static cache, and its parent cache being hit. In typical use when the static cache encounters a hit, it should not defer to the parent cache. Because the value test was not strict, these additional values were inlcuded and treated as though they had no value.

      This change:

      • addresses each of the locations where there was a non-strict result check; and
      • introduces a new cache_helper::result_found(mixed $value): bool helper which should be used within the cache API

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Huong Nguyen Huong Nguyen
            Jun Pataleta Jun Pataleta
            CiBoT CiBoT
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours
                7h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.