code: def all(self):
          
          if not preferences_settings.ENABLE_CACHE:
              return self.load_from_db()
  
          preferences = self.registry.preferences()
  
          # first we hit the cache once for all existing preferences
          a = self.many_from_cache(preferences)
          if len(a) == len(preferences):
              return a  # avoid database hit if not necessary
  
          # then we fill those that miss, but exist in the database
          # (just hit the database for all of them, filtering is complicated, and
          # in most cases you'd need to grab the majority of them anyway)
          a.update(self.load_from_db(cache=True))
          return a
docs: Return a dictionary containing all preferences by section
          Loaded from cache or from db in case of cold cache