code: def _user_perm_cache(self):
          
          # Check to see if the cache has been primed.
          if not self.user:
              return {}
          cache_filled = getattr(
              self.user,
              '_authority_perm_cache_filled',
              False,
          )
          if cache_filled:
              # Don't really like the name for this, but this matches how Django
              # does it.
              return self.user._authority_perm_cache
  
          # Prime the cache.
          self._prime_user_perm_caches()
          return self.user._authority_perm_cache
docs: cached_permissions will generate the cache in a lazy fashion.