code: def generate_key(self):
          
          sql = self.sql()
          key, created = self.get_or_create_model_key()
          if created:
              db_table = self.model._meta.db_table
              logger.debug('created new key {0} for model {1}'.format(key, db_table))
              model_cache_info = ModelCacheInfo(db_table, key)
              model_cache_backend.share_model_cache_info(model_cache_info)
          query_key = u'{model_key}{qs}{db}'.format(model_key=key,
                                                    qs=sql,
                                                    db=self.db)
          key = hashlib.md5(query_key.encode('utf-8')).hexdigest()
          return key
docs: Generate cache key for the current query. If a new key is created for the model it is
          then shared with other consumers.