code: def get_query_cache_key(compiler):
      
      sql, params = compiler.as_sql()
      check_parameter_types(params)
      cache_key = '%s:%s:%s' % (compiler.using, sql,
                                [text_type(p) for p in params])
      return sha1(cache_key.encode('utf-8')).hexdigest()
docs: Generates a cache key from a SQLCompiler.
  
      This cache key is specific to the SQL query and its context
      (which database is used).  The same query in the same context
      (= the same database) must generate the same cache key.
  
      :arg compiler: A SQLCompiler that will generate the SQL query
      :type compiler: django.db.models.sql.compiler.SQLCompiler
      :return: A cache key
      :rtype: int