docs: def cache_installed():
      """
      Returns ``True`` if a cache backend is configured, and the
      cache middleware classes or subclasses thereof are present.
      This will be evaluated once per run, and then cached.
      """
      has_key = bool(getattr(settings, "NEVERCACHE_KEY", ""))
  
      def flatten(seqs):
          return (item for seq in seqs for item in seq)
  
      middleware_classes = map(import_string, get_middleware_setting())
      middleware_ancestors = set(flatten(map(getmro, middleware_classes)))
  
      yacms_cache_middleware_classes = {
          import_string("yacms.core.middleware.UpdateCacheMiddleware"),
          import_string("yacms.core.middleware.FetchFromCacheMiddleware"),
      }
  
      return (has_key and settings.CACHES and not settings.TESTING and
              yacms_cache_middleware_classes.issubset(middleware_ancestors))